blob: 0f4cbbba707b181a224b51da71788e2d313cc6d9 [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;
Dianne Hackborn1d0b1772013-09-06 14:02:54 -070020import android.content.res.Configuration;
Alan Viveretteac85f902016-03-11 15:15:51 -050021import android.content.res.Configuration.NativeConfig;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.os.Parcel;
23import android.os.Parcelable;
24import android.util.Printer;
25
Tor Norbyed9273d62013-05-30 15:59:53 -070026import java.lang.annotation.Retention;
27import java.lang.annotation.RetentionPolicy;
28
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029/**
30 * Information you can retrieve about a particular application
31 * activity or receiver. This corresponds to information collected
32 * from the AndroidManifest.xml's <activity> and
33 * <receiver> tags.
34 */
35public class ActivityInfo extends ComponentInfo
36 implements Parcelable {
Robert Carr3e2e0112015-09-15 12:30:42 -070037
38 // NOTE: When adding new data members be sure to update the copy-constructor, Parcel
39 // constructor, and writeToParcel.
40
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041 /**
42 * A style resource identifier (in the package's resources) of this
43 * activity's theme. From the "theme" attribute or, if not set, 0.
44 */
45 public int theme;
Robert Carr3e2e0112015-09-15 12:30:42 -070046
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047 /**
48 * Constant corresponding to <code>standard</code> in
49 * the {@link android.R.attr#launchMode} attribute.
50 */
51 public static final int LAUNCH_MULTIPLE = 0;
52 /**
53 * Constant corresponding to <code>singleTop</code> in
54 * the {@link android.R.attr#launchMode} attribute.
55 */
56 public static final int LAUNCH_SINGLE_TOP = 1;
57 /**
58 * Constant corresponding to <code>singleTask</code> in
59 * the {@link android.R.attr#launchMode} attribute.
60 */
61 public static final int LAUNCH_SINGLE_TASK = 2;
62 /**
63 * Constant corresponding to <code>singleInstance</code> in
64 * the {@link android.R.attr#launchMode} attribute.
65 */
66 public static final int LAUNCH_SINGLE_INSTANCE = 3;
67 /**
68 * The launch mode style requested by the activity. From the
69 * {@link android.R.attr#launchMode} attribute, one of
70 * {@link #LAUNCH_MULTIPLE},
Filip Gruszczynskid2f1d942015-10-14 15:10:12 -070071 * {@link #LAUNCH_SINGLE_TOP}, {@link #LAUNCH_SINGLE_TASK}, or
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080072 * {@link #LAUNCH_SINGLE_INSTANCE}.
73 */
74 public int launchMode;
Craig Mautner2dac0562014-05-06 09:06:44 -070075
76 /**
77 * Constant corresponding to <code>none</code> in
78 * the {@link android.R.attr#documentLaunchMode} attribute.
79 */
80 public static final int DOCUMENT_LAUNCH_NONE = 0;
81 /**
82 * Constant corresponding to <code>intoExisting</code> in
83 * the {@link android.R.attr#documentLaunchMode} attribute.
84 */
85 public static final int DOCUMENT_LAUNCH_INTO_EXISTING = 1;
86 /**
87 * Constant corresponding to <code>always</code> in
88 * the {@link android.R.attr#documentLaunchMode} attribute.
89 */
90 public static final int DOCUMENT_LAUNCH_ALWAYS = 2;
91 /**
Craig Mautnerf357c0c2014-06-09 09:23:27 -070092 * Constant corresponding to <code>never</code> in
93 * the {@link android.R.attr#documentLaunchMode} attribute.
94 */
95 public static final int DOCUMENT_LAUNCH_NEVER = 3;
96 /**
Craig Mautner2dac0562014-05-06 09:06:44 -070097 * The document launch mode style requested by the activity. From the
98 * {@link android.R.attr#documentLaunchMode} attribute, one of
99 * {@link #DOCUMENT_LAUNCH_NONE}, {@link #DOCUMENT_LAUNCH_INTO_EXISTING},
100 * {@link #DOCUMENT_LAUNCH_ALWAYS}.
101 *
102 * <p>Modes DOCUMENT_LAUNCH_ALWAYS
103 * and DOCUMENT_LAUNCH_INTO_EXISTING are equivalent to {@link
104 * android.content.Intent#FLAG_ACTIVITY_NEW_DOCUMENT
105 * Intent.FLAG_ACTIVITY_NEW_DOCUMENT} with and without {@link
106 * android.content.Intent#FLAG_ACTIVITY_MULTIPLE_TASK
107 * Intent.FLAG_ACTIVITY_MULTIPLE_TASK} respectively.
108 */
109 public int documentLaunchMode;
110
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800111 /**
Craig Mautner43e52ed2014-06-16 17:18:52 -0700112 * Constant corresponding to <code>persistRootOnly</code> in
113 * the {@link android.R.attr#persistableMode} attribute.
114 */
115 public static final int PERSIST_ROOT_ONLY = 0;
116 /**
117 * Constant corresponding to <code>doNotPersist</code> in
118 * the {@link android.R.attr#persistableMode} attribute.
119 */
Craig Mautner7f72f532014-07-21 10:07:12 -0700120 public static final int PERSIST_NEVER = 1;
Craig Mautner43e52ed2014-06-16 17:18:52 -0700121 /**
122 * Constant corresponding to <code>persistAcrossReboots</code> in
123 * the {@link android.R.attr#persistableMode} attribute.
124 */
125 public static final int PERSIST_ACROSS_REBOOTS = 2;
126 /**
127 * Value indicating how this activity is to be persisted across
128 * reboots for restoring in the Recents list.
129 * {@link android.R.attr#persistableMode}
130 */
131 public int persistableMode;
132
133 /**
Craig Mautnerffcfcaa2014-06-05 09:54:38 -0700134 * The maximum number of tasks rooted at this activity that can be in the recent task list.
135 * Refer to {@link android.R.attr#maxRecents}.
136 */
137 public int maxRecents;
138
139 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800140 * Optional name of a permission required to be able to access this
141 * Activity. From the "permission" attribute.
142 */
143 public String permission;
Filip Gruszczynskid2f1d942015-10-14 15:10:12 -0700144
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800145 /**
146 * The affinity this activity has for another task in the system. The
147 * string here is the name of the task, often the package name of the
148 * overall package. If null, the activity has no affinity. Set from the
149 * {@link android.R.attr#taskAffinity} attribute.
150 */
151 public String taskAffinity;
Filip Gruszczynskid2f1d942015-10-14 15:10:12 -0700152
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800153 /**
154 * If this is an activity alias, this is the real activity class to run
155 * for it. Otherwise, this is null.
156 */
157 public String targetActivity;
Filip Gruszczynskid2f1d942015-10-14 15:10:12 -0700158
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800159 /**
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800160 * Activity can not be resized and always occupies the fullscreen area with all windows fully
161 * visible.
162 * @hide
163 */
164 public static final int RESIZE_MODE_UNRESIZEABLE = 0;
165 /**
166 * Activity can not be resized and always occupies the fullscreen area with all windows cropped
167 * to either the task or stack bounds.
168 * @hide
169 */
170 public static final int RESIZE_MODE_CROP_WINDOWS = 1;
171 /**
172 * Activity is resizeable.
173 * @hide
174 */
175 public static final int RESIZE_MODE_RESIZEABLE = 2;
176 /**
177 * Activity is resizeable and supported picture-in-picture mode.
178 * @hide
179 */
180 public static final int RESIZE_MODE_RESIZEABLE_AND_PIPABLE = 3;
181 /**
Wale Ogunwaled829d362016-02-10 19:24:49 -0800182 * Activity is does not support resizing, but we are forcing it to be resizeable.
183 * @hide
184 */
185 public static final int RESIZE_MODE_FORCE_RESIZEABLE = 4;
186 /**
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800187 * Value indicating if the resizing mode the activity supports.
188 * See {@link android.R.attr#resizeableActivity}.
189 * @hide
190 */
191 public int resizeMode;
192
193 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800194 * Bit in {@link #flags} indicating whether this activity is able to
195 * run in multiple processes. If
196 * true, the system may instantiate it in the some process as the
197 * process starting it in order to conserve resources. If false, the
198 * default, it always runs in {@link #processName}. Set from the
199 * {@link android.R.attr#multiprocess} attribute.
200 */
201 public static final int FLAG_MULTIPROCESS = 0x0001;
202 /**
203 * Bit in {@link #flags} indicating that, when the activity's task is
204 * relaunched from home, this activity should be finished.
205 * Set from the
206 * {@link android.R.attr#finishOnTaskLaunch} attribute.
207 */
208 public static final int FLAG_FINISH_ON_TASK_LAUNCH = 0x0002;
209 /**
210 * Bit in {@link #flags} indicating that, when the activity is the root
211 * of a task, that task's stack should be cleared each time the user
212 * re-launches it from home. As a result, the user will always
213 * return to the original activity at the top of the task.
214 * This flag only applies to activities that
215 * are used to start the root of a new task. Set from the
216 * {@link android.R.attr#clearTaskOnLaunch} attribute.
217 */
218 public static final int FLAG_CLEAR_TASK_ON_LAUNCH = 0x0004;
219 /**
220 * Bit in {@link #flags} indicating that, when the activity is the root
221 * of a task, that task's stack should never be cleared when it is
222 * relaunched from home. Set from the
223 * {@link android.R.attr#alwaysRetainTaskState} attribute.
224 */
225 public static final int FLAG_ALWAYS_RETAIN_TASK_STATE = 0x0008;
226 /**
227 * Bit in {@link #flags} indicating that the activity's state
228 * is not required to be saved, so that if there is a failure the
229 * activity will not be removed from the activity stack. Set from the
230 * {@link android.R.attr#stateNotNeeded} attribute.
231 */
232 public static final int FLAG_STATE_NOT_NEEDED = 0x0010;
233 /**
234 * Bit in {@link #flags} that indicates that the activity should not
235 * appear in the list of recently launched activities. Set from the
236 * {@link android.R.attr#excludeFromRecents} attribute.
237 */
238 public static final int FLAG_EXCLUDE_FROM_RECENTS = 0x0020;
239 /**
240 * Bit in {@link #flags} that indicates that the activity can be moved
241 * between tasks based on its task affinity. Set from the
242 * {@link android.R.attr#allowTaskReparenting} attribute.
243 */
244 public static final int FLAG_ALLOW_TASK_REPARENTING = 0x0040;
245 /**
246 * Bit in {@link #flags} indicating that, when the user navigates away
247 * from an activity, it should be finished.
248 * Set from the
249 * {@link android.R.attr#noHistory} attribute.
250 */
251 public static final int FLAG_NO_HISTORY = 0x0080;
252 /**
Dianne Hackbornffa42482009-09-23 22:20:11 -0700253 * Bit in {@link #flags} indicating that, when a request to close system
254 * windows happens, this activity is finished.
255 * Set from the
256 * {@link android.R.attr#finishOnCloseSystemDialogs} attribute.
257 */
258 public static final int FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS = 0x0100;
Dianne Hackborn327fbd22011-01-17 14:38:50 -0800259 /**
260 * Value for {@link #flags}: true when the application's rendering should
261 * be hardware accelerated.
262 */
263 public static final int FLAG_HARDWARE_ACCELERATED = 0x0200;
264 /**
Wale Ogunwale6dfdfd62015-04-15 12:01:38 -0700265 * Value for {@link #flags}: true when the application can be displayed for all users
266 * regardless of if the user of the application is the current user. Set from the
267 * {@link android.R.attr#showForAllUsers} attribute.
Craig Mautner5962b122012-10-05 14:45:52 -0700268 * @hide
269 */
Wale Ogunwale6dfdfd62015-04-15 12:01:38 -0700270 public static final int FLAG_SHOW_FOR_ALL_USERS = 0x0400;
Craig Mautner5962b122012-10-05 14:45:52 -0700271 /**
John Spurlock322d7712013-09-05 02:39:46 +0000272 * Bit in {@link #flags} corresponding to an immersive activity
Daniel Sandler613dde42010-06-21 13:46:39 -0400273 * that wishes not to be interrupted by notifications.
274 * Applications that hide the system notification bar with
275 * {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN}
276 * may still be interrupted by high-priority notifications; for example, an
277 * incoming phone call may use
Daniel Sandler8091ca52010-06-22 13:58:46 -0400278 * {@link android.app.Notification#fullScreenIntent fullScreenIntent}
Daniel Sandler613dde42010-06-21 13:46:39 -0400279 * to present a full-screen in-call activity to the user, pausing the
280 * current activity as a side-effect. An activity with
281 * {@link #FLAG_IMMERSIVE} set, however, will not be interrupted; the
282 * notification may be shown in some other way (such as a small floating
283 * "toast" window).
Christopher Tate73c2aee2012-03-15 16:27:14 -0700284 *
285 * Note that this flag will always reflect the Activity's
286 * <code>android:immersive</code> manifest definition, even if the Activity's
287 * immersive state is changed at runtime via
288 * {@link android.app.Activity#setImmersive(boolean)}.
289 *
290 * @see android.app.Notification#FLAG_HIGH_PRIORITY
291 * @see android.app.Activity#setImmersive(boolean)
Daniel Sandler613dde42010-06-21 13:46:39 -0400292 */
Craig Mautner5962b122012-10-05 14:45:52 -0700293 public static final int FLAG_IMMERSIVE = 0x0800;
Romain Guy529b60a2010-08-03 18:05:47 -0700294 /**
Craig Mautner9d4e9bc2014-06-18 18:34:56 -0700295 * Bit in {@link #flags}: If set, a task rooted at this activity will have its
296 * baseIntent replaced by the activity immediately above this. Each activity may further
297 * relinquish its identity to the activity above it using this flag. Set from the
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700298 * {@link android.R.attr#relinquishTaskIdentity} attribute.
Craig Mautner9d4e9bc2014-06-18 18:34:56 -0700299 */
300 public static final int FLAG_RELINQUISH_TASK_IDENTITY = 0x1000;
301 /**
Craig Mautner2dac0562014-05-06 09:06:44 -0700302 * Bit in {@link #flags} indicating that tasks started with this activity are to be
303 * removed from the recent list of tasks when the last activity in the task is finished.
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700304 * Corresponds to {@link android.R.attr#autoRemoveFromRecents}
Craig Mautner2dac0562014-05-06 09:06:44 -0700305 */
306 public static final int FLAG_AUTO_REMOVE_FROM_RECENTS = 0x2000;
307 /**
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700308 * Bit in {@link #flags} indicating that this activity can start is creation/resume
309 * while the previous activity is still pausing. Corresponds to
310 * {@link android.R.attr#resumeWhilePausing}
311 */
312 public static final int FLAG_RESUME_WHILE_PAUSING = 0x4000;
313 /**
Ruben Brunkdd18a0b2015-12-04 16:16:31 -0800314 * Bit in {@link #flags} indicating that this activity should be run with VR mode enabled.
315 *
316 * {@see android.app.Activity#setVrMode(boolean)}.
317 */
318 public static final int FLAG_ENABLE_VR_MODE = 0x8000;
Wale Ogunwale6cae7652015-12-26 07:36:26 -0800319
320 /**
Wale Ogunwale6cae7652015-12-26 07:36:26 -0800321 * Bit in {@link #flags} indicating if the activity is always focusable regardless of if it is
322 * in a task/stack whose activities are normally not focusable.
323 * See android.R.attr#alwaysFocusable.
324 * @hide
325 */
326 public static final int FLAG_ALWAYS_FOCUSABLE = 0x40000;
327
Ruben Brunkdd18a0b2015-12-04 16:16:31 -0800328 /**
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -0700329 * @hide Bit in {@link #flags}: If set, this component will only be seen
Fyodor Kupolov4f5de342015-08-25 10:08:45 -0700330 * by the system user. Only works with broadcast receivers. Set from the
331 * android.R.attr#systemUserOnly attribute.
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -0700332 */
Fyodor Kupolov4f5de342015-08-25 10:08:45 -0700333 public static final int FLAG_SYSTEM_USER_ONLY = 0x20000000;
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -0700334 /**
Dianne Hackborn7d19e022012-08-07 19:12:33 -0700335 * Bit in {@link #flags}: If set, a single instance of the receiver will
336 * run for all users on the device. Set from the
337 * {@link android.R.attr#singleUser} attribute. Note that this flag is
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -0700338 * only relevant for ActivityInfo structures that are describing receiver
Dianne Hackborn7d19e022012-08-07 19:12:33 -0700339 * components; it is not applied to activities.
340 */
341 public static final int FLAG_SINGLE_USER = 0x40000000;
342 /**
Craig Mautnerffd14a12014-04-23 21:38:50 -0700343 * @hide Bit in {@link #flags}: If set, this activity may be launched into an
344 * owned ActivityContainer such as that within an ActivityView. If not set and
Svet Ganovf2acc542015-11-06 09:02:00 -0800345 * this activity is launched into such a container a SecurityException will be
Craig Mautnerffd14a12014-04-23 21:38:50 -0700346 * thrown. Set from the {@link android.R.attr#allowEmbedded} attribute.
347 */
348 public static final int FLAG_ALLOW_EMBEDDED = 0x80000000;
349 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800350 * Options that have been set in the activity declaration in the
Daniel Sandler613dde42010-06-21 13:46:39 -0400351 * manifest.
352 * These include:
353 * {@link #FLAG_MULTIPROCESS},
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 * {@link #FLAG_FINISH_ON_TASK_LAUNCH}, {@link #FLAG_CLEAR_TASK_ON_LAUNCH},
355 * {@link #FLAG_ALWAYS_RETAIN_TASK_STATE},
356 * {@link #FLAG_STATE_NOT_NEEDED}, {@link #FLAG_EXCLUDE_FROM_RECENTS},
Dianne Hackbornffa42482009-09-23 22:20:11 -0700357 * {@link #FLAG_ALLOW_TASK_REPARENTING}, {@link #FLAG_NO_HISTORY},
Daniel Sandler613dde42010-06-21 13:46:39 -0400358 * {@link #FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS},
Dianne Hackborn7d19e022012-08-07 19:12:33 -0700359 * {@link #FLAG_HARDWARE_ACCELERATED}, {@link #FLAG_SINGLE_USER}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800360 */
361 public int flags;
362
Tor Norbyed9273d62013-05-30 15:59:53 -0700363 /** @hide */
364 @IntDef({
365 SCREEN_ORIENTATION_UNSPECIFIED,
366 SCREEN_ORIENTATION_LANDSCAPE,
367 SCREEN_ORIENTATION_PORTRAIT,
368 SCREEN_ORIENTATION_USER,
369 SCREEN_ORIENTATION_BEHIND,
370 SCREEN_ORIENTATION_SENSOR,
371 SCREEN_ORIENTATION_NOSENSOR,
372 SCREEN_ORIENTATION_SENSOR_LANDSCAPE,
373 SCREEN_ORIENTATION_SENSOR_PORTRAIT,
374 SCREEN_ORIENTATION_REVERSE_LANDSCAPE,
375 SCREEN_ORIENTATION_REVERSE_PORTRAIT,
376 SCREEN_ORIENTATION_FULL_SENSOR,
377 SCREEN_ORIENTATION_USER_LANDSCAPE,
378 SCREEN_ORIENTATION_USER_PORTRAIT,
379 SCREEN_ORIENTATION_FULL_USER,
380 SCREEN_ORIENTATION_LOCKED
381 })
382 @Retention(RetentionPolicy.SOURCE)
383 public @interface ScreenOrientation {}
384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800385 /**
386 * Constant corresponding to <code>unspecified</code> in
387 * the {@link android.R.attr#screenOrientation} attribute.
388 */
389 public static final int SCREEN_ORIENTATION_UNSPECIFIED = -1;
390 /**
391 * Constant corresponding to <code>landscape</code> in
392 * the {@link android.R.attr#screenOrientation} attribute.
393 */
394 public static final int SCREEN_ORIENTATION_LANDSCAPE = 0;
395 /**
396 * Constant corresponding to <code>portrait</code> in
397 * the {@link android.R.attr#screenOrientation} attribute.
398 */
399 public static final int SCREEN_ORIENTATION_PORTRAIT = 1;
400 /**
401 * Constant corresponding to <code>user</code> in
402 * the {@link android.R.attr#screenOrientation} attribute.
403 */
404 public static final int SCREEN_ORIENTATION_USER = 2;
405 /**
406 * Constant corresponding to <code>behind</code> in
407 * the {@link android.R.attr#screenOrientation} attribute.
408 */
409 public static final int SCREEN_ORIENTATION_BEHIND = 3;
410 /**
411 * Constant corresponding to <code>sensor</code> in
412 * the {@link android.R.attr#screenOrientation} attribute.
413 */
414 public static final int SCREEN_ORIENTATION_SENSOR = 4;
Filip Gruszczynskid2f1d942015-10-14 15:10:12 -0700415
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800416 /**
Dianne Hackborne5439f22010-10-02 16:53:50 -0700417 * Constant corresponding to <code>nosensor</code> in
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800418 * the {@link android.R.attr#screenOrientation} attribute.
419 */
420 public static final int SCREEN_ORIENTATION_NOSENSOR = 5;
Dianne Hackborne5439f22010-10-02 16:53:50 -0700421
422 /**
423 * Constant corresponding to <code>sensorLandscape</code> in
424 * the {@link android.R.attr#screenOrientation} attribute.
425 */
426 public static final int SCREEN_ORIENTATION_SENSOR_LANDSCAPE = 6;
427
428 /**
429 * Constant corresponding to <code>sensorPortrait</code> in
430 * the {@link android.R.attr#screenOrientation} attribute.
431 */
432 public static final int SCREEN_ORIENTATION_SENSOR_PORTRAIT = 7;
433
434 /**
435 * Constant corresponding to <code>reverseLandscape</code> in
436 * the {@link android.R.attr#screenOrientation} attribute.
437 */
438 public static final int SCREEN_ORIENTATION_REVERSE_LANDSCAPE = 8;
439
440 /**
441 * Constant corresponding to <code>reversePortrait</code> in
442 * the {@link android.R.attr#screenOrientation} attribute.
443 */
444 public static final int SCREEN_ORIENTATION_REVERSE_PORTRAIT = 9;
445
446 /**
447 * Constant corresponding to <code>fullSensor</code> in
448 * the {@link android.R.attr#screenOrientation} attribute.
449 */
450 public static final int SCREEN_ORIENTATION_FULL_SENSOR = 10;
451
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800452 /**
Dianne Hackbornb9ec1ac2013-04-10 17:34:25 -0700453 * Constant corresponding to <code>userLandscape</code> in
454 * the {@link android.R.attr#screenOrientation} attribute.
455 */
456 public static final int SCREEN_ORIENTATION_USER_LANDSCAPE = 11;
457
458 /**
459 * Constant corresponding to <code>userPortrait</code> in
460 * the {@link android.R.attr#screenOrientation} attribute.
461 */
462 public static final int SCREEN_ORIENTATION_USER_PORTRAIT = 12;
463
464 /**
465 * Constant corresponding to <code>fullUser</code> in
466 * the {@link android.R.attr#screenOrientation} attribute.
467 */
468 public static final int SCREEN_ORIENTATION_FULL_USER = 13;
469
470 /**
471 * Constant corresponding to <code>locked</code> in
472 * the {@link android.R.attr#screenOrientation} attribute.
473 */
474 public static final int SCREEN_ORIENTATION_LOCKED = 14;
475
476 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800477 * The preferred screen orientation this activity would like to run in.
478 * From the {@link android.R.attr#screenOrientation} attribute, one of
479 * {@link #SCREEN_ORIENTATION_UNSPECIFIED},
Filip Gruszczynskid2f1d942015-10-14 15:10:12 -0700480 * {@link #SCREEN_ORIENTATION_LANDSCAPE},
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800481 * {@link #SCREEN_ORIENTATION_PORTRAIT},
482 * {@link #SCREEN_ORIENTATION_USER},
483 * {@link #SCREEN_ORIENTATION_BEHIND},
484 * {@link #SCREEN_ORIENTATION_SENSOR},
Dianne Hackborne5439f22010-10-02 16:53:50 -0700485 * {@link #SCREEN_ORIENTATION_NOSENSOR},
486 * {@link #SCREEN_ORIENTATION_SENSOR_LANDSCAPE},
487 * {@link #SCREEN_ORIENTATION_SENSOR_PORTRAIT},
488 * {@link #SCREEN_ORIENTATION_REVERSE_LANDSCAPE},
489 * {@link #SCREEN_ORIENTATION_REVERSE_PORTRAIT},
Dianne Hackbornb9ec1ac2013-04-10 17:34:25 -0700490 * {@link #SCREEN_ORIENTATION_FULL_SENSOR},
491 * {@link #SCREEN_ORIENTATION_USER_LANDSCAPE},
492 * {@link #SCREEN_ORIENTATION_USER_PORTRAIT},
493 * {@link #SCREEN_ORIENTATION_FULL_USER},
494 * {@link #SCREEN_ORIENTATION_LOCKED},
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800495 */
Tor Norbyed9273d62013-05-30 15:59:53 -0700496 @ScreenOrientation
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800497 public int screenOrientation = SCREEN_ORIENTATION_UNSPECIFIED;
Filip Gruszczynskid2f1d942015-10-14 15:10:12 -0700498
Alan Viveretteac85f902016-03-11 15:15:51 -0500499 /** @hide */
500 @IntDef(flag = true,
501 value = {
502 CONFIG_MCC,
503 CONFIG_MNC,
504 CONFIG_LOCALE,
505 CONFIG_TOUCHSCREEN,
506 CONFIG_KEYBOARD,
507 CONFIG_KEYBOARD_HIDDEN,
508 CONFIG_NAVIGATION,
509 CONFIG_ORIENTATION,
510 CONFIG_SCREEN_LAYOUT,
511 CONFIG_UI_MODE,
512 CONFIG_SCREEN_SIZE,
513 CONFIG_SMALLEST_SCREEN_SIZE,
514 CONFIG_DENSITY,
515 CONFIG_LAYOUT_DIRECTION,
516 CONFIG_FONT_SCALE,
517 })
518 @Retention(RetentionPolicy.SOURCE)
519 public @interface Config {}
520
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800521 /**
522 * Bit in {@link #configChanges} that indicates that the activity
523 * can itself handle changes to the IMSI MCC. Set from the
524 * {@link android.R.attr#configChanges} attribute.
525 */
526 public static final int CONFIG_MCC = 0x0001;
527 /**
528 * Bit in {@link #configChanges} that indicates that the activity
529 * can itself handle changes to the IMSI MNC. Set from the
530 * {@link android.R.attr#configChanges} attribute.
531 */
532 public static final int CONFIG_MNC = 0x0002;
533 /**
534 * Bit in {@link #configChanges} that indicates that the activity
535 * can itself handle changes to the locale. Set from the
536 * {@link android.R.attr#configChanges} attribute.
537 */
538 public static final int CONFIG_LOCALE = 0x0004;
539 /**
540 * Bit in {@link #configChanges} that indicates that the activity
541 * can itself handle changes to the touchscreen type. Set from the
542 * {@link android.R.attr#configChanges} attribute.
543 */
544 public static final int CONFIG_TOUCHSCREEN = 0x0008;
545 /**
546 * Bit in {@link #configChanges} that indicates that the activity
547 * can itself handle changes to the keyboard type. Set from the
548 * {@link android.R.attr#configChanges} attribute.
549 */
550 public static final int CONFIG_KEYBOARD = 0x0010;
551 /**
552 * Bit in {@link #configChanges} that indicates that the activity
Dianne Hackborn93e462b2009-09-15 22:50:40 -0700553 * can itself handle changes to the keyboard or navigation being hidden/exposed.
554 * Note that inspite of the name, this applies to the changes to any
555 * hidden states: keyboard or navigation.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800556 * Set from the {@link android.R.attr#configChanges} attribute.
557 */
558 public static final int CONFIG_KEYBOARD_HIDDEN = 0x0020;
559 /**
560 * Bit in {@link #configChanges} that indicates that the activity
561 * can itself handle changes to the navigation type. Set from the
562 * {@link android.R.attr#configChanges} attribute.
563 */
564 public static final int CONFIG_NAVIGATION = 0x0040;
565 /**
566 * Bit in {@link #configChanges} that indicates that the activity
567 * can itself handle changes to the screen orientation. Set from the
568 * {@link android.R.attr#configChanges} attribute.
569 */
570 public static final int CONFIG_ORIENTATION = 0x0080;
571 /**
572 * Bit in {@link #configChanges} that indicates that the activity
Dianne Hackborn723738c2009-06-25 19:48:04 -0700573 * can itself handle changes to the screen layout. Set from the
574 * {@link android.R.attr#configChanges} attribute.
575 */
576 public static final int CONFIG_SCREEN_LAYOUT = 0x0100;
577 /**
578 * Bit in {@link #configChanges} that indicates that the activity
Tobias Haamel27b28b32010-02-09 23:09:17 +0100579 * can itself handle the ui mode. Set from the
580 * {@link android.R.attr#configChanges} attribute.
Tobias Haamel27b28b32010-02-09 23:09:17 +0100581 */
582 public static final int CONFIG_UI_MODE = 0x0200;
583 /**
584 * Bit in {@link #configChanges} that indicates that the activity
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700585 * can itself handle the screen size. Set from the
Dianne Hackborne6676352011-06-01 16:51:20 -0700586 * {@link android.R.attr#configChanges} attribute. This will be
587 * set by default for applications that target an earlier version
588 * than {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}...
589 * <b>however</b>, you will not see the bit set here becomes some
590 * applications incorrectly compare {@link #configChanges} against
591 * an absolute value rather than correctly masking out the bits
592 * they are interested in. Please don't do that, thanks.
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700593 */
594 public static final int CONFIG_SCREEN_SIZE = 0x0400;
595 /**
596 * Bit in {@link #configChanges} that indicates that the activity
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700597 * can itself handle the smallest screen size. Set from the
Dianne Hackborne6676352011-06-01 16:51:20 -0700598 * {@link android.R.attr#configChanges} attribute. This will be
599 * set by default for applications that target an earlier version
600 * than {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}...
601 * <b>however</b>, you will not see the bit set here becomes some
602 * applications incorrectly compare {@link #configChanges} against
603 * an absolute value rather than correctly masking out the bits
604 * they are interested in. Please don't do that, thanks.
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700605 */
606 public static final int CONFIG_SMALLEST_SCREEN_SIZE = 0x0800;
607 /**
608 * Bit in {@link #configChanges} that indicates that the activity
Dianne Hackborn908aecc2012-07-31 16:37:34 -0700609 * can itself handle density changes. Set from the
610 * {@link android.R.attr#configChanges} attribute.
611 */
612 public static final int CONFIG_DENSITY = 0x1000;
613 /**
614 * Bit in {@link #configChanges} that indicates that the activity
Fabrice Di Meglio5f797992012-06-15 20:16:41 -0700615 * can itself handle the change to layout direction. Set from the
616 * {@link android.R.attr#configChanges} attribute.
617 */
618 public static final int CONFIG_LAYOUT_DIRECTION = 0x2000;
619 /**
620 * Bit in {@link #configChanges} that indicates that the activity
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800621 * can itself handle changes to the font scaling factor. Set from the
622 * {@link android.R.attr#configChanges} attribute. This is
Fabrice Di Megliodc25d252013-04-09 18:04:29 -0700623 * not a core resource configuration, but a higher-level value, so its
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800624 * constant starts at the high bits.
625 */
626 public static final int CONFIG_FONT_SCALE = 0x40000000;
Filip Gruszczynskid2f1d942015-10-14 15:10:12 -0700627
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700628 /** @hide
629 * Unfortunately the constants for config changes in native code are
630 * different from ActivityInfo. :( Here are the values we should use for the
631 * native side given the bit we have assigned in ActivityInfo.
632 */
633 public static int[] CONFIG_NATIVE_BITS = new int[] {
Dianne Hackborn1d0b1772013-09-06 14:02:54 -0700634 Configuration.NATIVE_CONFIG_MNC, // MNC
635 Configuration.NATIVE_CONFIG_MCC, // MCC
636 Configuration.NATIVE_CONFIG_LOCALE, // LOCALE
637 Configuration.NATIVE_CONFIG_TOUCHSCREEN, // TOUCH SCREEN
638 Configuration.NATIVE_CONFIG_KEYBOARD, // KEYBOARD
639 Configuration.NATIVE_CONFIG_KEYBOARD_HIDDEN, // KEYBOARD HIDDEN
640 Configuration.NATIVE_CONFIG_NAVIGATION, // NAVIGATION
641 Configuration.NATIVE_CONFIG_ORIENTATION, // ORIENTATION
642 Configuration.NATIVE_CONFIG_SCREEN_LAYOUT, // SCREEN LAYOUT
643 Configuration.NATIVE_CONFIG_UI_MODE, // UI MODE
644 Configuration.NATIVE_CONFIG_SCREEN_SIZE, // SCREEN SIZE
645 Configuration.NATIVE_CONFIG_SMALLEST_SCREEN_SIZE, // SMALLEST SCREEN SIZE
646 Configuration.NATIVE_CONFIG_DENSITY, // DENSITY
647 Configuration.NATIVE_CONFIG_LAYOUTDIR, // LAYOUT DIRECTION
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700648 };
Alan Viverettec1d52792015-05-05 09:49:03 -0700649
650 /**
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700651 * Convert Java change bits to native.
Alan Viverettec1d52792015-05-05 09:49:03 -0700652 *
653 * @hide
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700654 */
Alan Viveretteac85f902016-03-11 15:15:51 -0500655 public static @NativeConfig int activityInfoConfigJavaToNative(@Config int input) {
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700656 int output = 0;
Alan Viverettec1d52792015-05-05 09:49:03 -0700657 for (int i = 0; i < CONFIG_NATIVE_BITS.length; i++) {
658 if ((input & (1 << i)) != 0) {
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700659 output |= CONFIG_NATIVE_BITS[i];
660 }
661 }
662 return output;
663 }
664
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800665 /**
Alan Viverettec1d52792015-05-05 09:49:03 -0700666 * Convert native change bits to Java.
667 *
668 * @hide
669 */
Alan Viveretteac85f902016-03-11 15:15:51 -0500670 public static @Config int activityInfoConfigNativeToJava(@NativeConfig int input) {
Alan Viverettec1d52792015-05-05 09:49:03 -0700671 int output = 0;
672 for (int i = 0; i < CONFIG_NATIVE_BITS.length; i++) {
673 if ((input & CONFIG_NATIVE_BITS[i]) != 0) {
674 output |= (1 << i);
675 }
676 }
677 return output;
678 }
679
680 /**
Dianne Hackborne6676352011-06-01 16:51:20 -0700681 * @hide
682 * Unfortunately some developers (OpenFeint I am looking at you) have
683 * compared the configChanges bit field against absolute values, so if we
684 * introduce a new bit they break. To deal with that, we will make sure
685 * the public field will not have a value that breaks them, and let the
686 * framework call here to get the real value.
687 */
688 public int getRealConfigChanged() {
689 return applicationInfo.targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB_MR2
690 ? (configChanges | ActivityInfo.CONFIG_SCREEN_SIZE
691 | ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE)
692 : configChanges;
693 }
694
695 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800696 * Bit mask of kinds of configuration changes that this activity
697 * can handle itself (without being restarted by the system).
698 * Contains any combination of {@link #CONFIG_FONT_SCALE},
699 * {@link #CONFIG_MCC}, {@link #CONFIG_MNC},
700 * {@link #CONFIG_LOCALE}, {@link #CONFIG_TOUCHSCREEN},
Dianne Hackborn723738c2009-06-25 19:48:04 -0700701 * {@link #CONFIG_KEYBOARD}, {@link #CONFIG_NAVIGATION},
Alan Viverette28c4a0b2015-11-20 17:23:46 -0500702 * {@link #CONFIG_ORIENTATION}, {@link #CONFIG_SCREEN_LAYOUT},
703 * {@link #CONFIG_DENSITY}, and {@link #CONFIG_LAYOUT_DIRECTION}.
704 * Set from the {@link android.R.attr#configChanges} attribute.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800705 */
706 public int configChanges;
Craig Mautner15df08a2015-04-01 12:17:18 -0700707
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800708 /**
709 * The desired soft input mode for this activity's main window.
710 * Set from the {@link android.R.attr#windowSoftInputMode} attribute
711 * in the activity's manifest. May be any of the same values allowed
712 * for {@link android.view.WindowManager.LayoutParams#softInputMode
713 * WindowManager.LayoutParams.softInputMode}. If 0 (unspecified),
714 * the mode from the theme will be used.
715 */
716 public int softInputMode;
Adam Powell269248d2011-08-02 10:26:54 -0700717
718 /**
719 * The desired extra UI options for this activity and its main window.
720 * Set from the {@link android.R.attr#uiOptions} attribute in the
721 * activity's manifest.
722 */
723 public int uiOptions = 0;
724
725 /**
Scott Maine797ed62011-09-22 16:17:45 -0700726 * Flag for use with {@link #uiOptions}.
727 * Indicates that the action bar should put all action items in a separate bar when
728 * the screen is narrow.
729 * <p>This value corresponds to "splitActionBarWhenNarrow" for the {@link #uiOptions} XML
730 * attribute.
Adam Powell269248d2011-08-02 10:26:54 -0700731 */
732 public static final int UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW = 1;
733
Adam Powelldd8fab22012-03-22 17:47:27 -0700734 /**
735 * If defined, the activity named here is the logical parent of this activity.
736 */
737 public String parentActivityName;
738
Craig Mautner15df08a2015-04-01 12:17:18 -0700739 /** @hide */
740 public static final int LOCK_TASK_LAUNCH_MODE_DEFAULT = 0;
741 /** @hide */
742 public static final int LOCK_TASK_LAUNCH_MODE_NEVER = 1;
743 /** @hide */
744 public static final int LOCK_TASK_LAUNCH_MODE_ALWAYS = 2;
745 /** @hide */
746 public static final int LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED = 3;
747
748 /** @hide */
749 public static final String lockTaskLaunchModeToString(int lockTaskLaunchMode) {
750 switch (lockTaskLaunchMode) {
751 case LOCK_TASK_LAUNCH_MODE_DEFAULT:
752 return "LOCK_TASK_LAUNCH_MODE_DEFAULT";
753 case LOCK_TASK_LAUNCH_MODE_NEVER:
754 return "LOCK_TASK_LAUNCH_MODE_NEVER";
755 case LOCK_TASK_LAUNCH_MODE_ALWAYS:
756 return "LOCK_TASK_LAUNCH_MODE_ALWAYS";
757 case LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED:
758 return "LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED";
759 default:
760 return "unknown=" + lockTaskLaunchMode;
761 }
762 }
763 /**
764 * Value indicating if the activity is to be locked at startup. Takes on the values from
765 * {@link android.R.attr#lockTaskMode}.
766 * @hide
767 */
768 public int lockTaskLaunchMode;
769
Andrii Kulian2e751b82016-03-16 16:59:32 -0700770 /**
771 * Information about desired position and size of activity on the display when
772 * it is first started.
773 */
774 public WindowLayout windowLayout;
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -0700775
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800776 public ActivityInfo() {
777 }
778
779 public ActivityInfo(ActivityInfo orig) {
780 super(orig);
781 theme = orig.theme;
782 launchMode = orig.launchMode;
Robert Carr3e2e0112015-09-15 12:30:42 -0700783 documentLaunchMode = orig.documentLaunchMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800784 permission = orig.permission;
785 taskAffinity = orig.taskAffinity;
786 targetActivity = orig.targetActivity;
787 flags = orig.flags;
788 screenOrientation = orig.screenOrientation;
789 configChanges = orig.configChanges;
790 softInputMode = orig.softInputMode;
Adam Powell269248d2011-08-02 10:26:54 -0700791 uiOptions = orig.uiOptions;
Adam Powelldd8fab22012-03-22 17:47:27 -0700792 parentActivityName = orig.parentActivityName;
Craig Mautner8307ea72014-09-11 15:03:53 -0700793 maxRecents = orig.maxRecents;
Craig Mautner15df08a2015-04-01 12:17:18 -0700794 lockTaskLaunchMode = orig.lockTaskLaunchMode;
Andrii Kulian2e751b82016-03-16 16:59:32 -0700795 windowLayout = orig.windowLayout;
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800796 resizeMode = orig.resizeMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800797 }
Craig Mautner15df08a2015-04-01 12:17:18 -0700798
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800799 /**
800 * Return the theme resource identifier to use for this activity. If
801 * the activity defines a theme, that is used; else, the application
802 * theme is used.
Craig Mautner15df08a2015-04-01 12:17:18 -0700803 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800804 * @return The theme associated with this activity.
805 */
806 public final int getThemeResource() {
807 return theme != 0 ? theme : applicationInfo.theme;
808 }
809
Craig Mautner43e52ed2014-06-16 17:18:52 -0700810 private String persistableModeToString() {
811 switch(persistableMode) {
812 case PERSIST_ROOT_ONLY: return "PERSIST_ROOT_ONLY";
Craig Mautner7f72f532014-07-21 10:07:12 -0700813 case PERSIST_NEVER: return "PERSIST_NEVER";
Craig Mautner43e52ed2014-06-16 17:18:52 -0700814 case PERSIST_ACROSS_REBOOTS: return "PERSIST_ACROSS_REBOOTS";
815 default: return "UNKNOWN=" + persistableMode;
816 }
817 }
818
Wale Ogunwale508ff552016-02-15 19:31:50 -0800819 /**
820 * Returns true if the activity's orientation is fixed.
821 * @hide
822 */
823 boolean isFixedOrientation() {
824 return screenOrientation == SCREEN_ORIENTATION_LANDSCAPE
825 || screenOrientation == SCREEN_ORIENTATION_PORTRAIT
826 || screenOrientation == SCREEN_ORIENTATION_SENSOR_LANDSCAPE
827 || screenOrientation == SCREEN_ORIENTATION_SENSOR_PORTRAIT
828 || screenOrientation == SCREEN_ORIENTATION_REVERSE_LANDSCAPE
829 || screenOrientation == SCREEN_ORIENTATION_REVERSE_PORTRAIT
830 || screenOrientation == SCREEN_ORIENTATION_USER_LANDSCAPE
831 || screenOrientation == SCREEN_ORIENTATION_USER_PORTRAIT
832 || screenOrientation == SCREEN_ORIENTATION_LOCKED;
833 }
834
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800835 /** @hide */
Wale Ogunwaleb1faf602016-01-27 09:12:31 -0800836 public static boolean isResizeableMode(int mode) {
Wale Ogunwaled829d362016-02-10 19:24:49 -0800837 return mode == RESIZE_MODE_RESIZEABLE
838 || mode == RESIZE_MODE_RESIZEABLE_AND_PIPABLE
839 || mode == RESIZE_MODE_FORCE_RESIZEABLE;
Wale Ogunwaleb1faf602016-01-27 09:12:31 -0800840 }
841
842 /** @hide */
843 public static String resizeModeToString(int mode) {
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800844 switch (mode) {
845 case RESIZE_MODE_UNRESIZEABLE:
846 return "RESIZE_MODE_UNRESIZEABLE";
847 case RESIZE_MODE_CROP_WINDOWS:
848 return "RESIZE_MODE_CROP_WINDOWS";
849 case RESIZE_MODE_RESIZEABLE:
850 return "RESIZE_MODE_RESIZEABLE";
851 case RESIZE_MODE_RESIZEABLE_AND_PIPABLE:
852 return "RESIZE_MODE_RESIZEABLE_AND_PIPABLE";
Wale Ogunwaled829d362016-02-10 19:24:49 -0800853 case RESIZE_MODE_FORCE_RESIZEABLE:
854 return "RESIZE_MODE_FORCE_RESIZEABLE";
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800855 default:
856 return "unknown=" + mode;
857 }
858 }
859
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800860 public void dump(Printer pw, String prefix) {
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -0800861 dump(pw, prefix, DUMP_FLAG_ALL);
862 }
863
864 /** @hide */
865 public void dump(Printer pw, String prefix, int flags) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800866 super.dumpFront(pw, prefix);
Dianne Hackborn12527f92009-11-11 17:39:50 -0800867 if (permission != null) {
868 pw.println(prefix + "permission=" + permission);
869 }
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -0800870 if ((flags&DUMP_FLAG_DETAILS) != 0) {
871 pw.println(prefix + "taskAffinity=" + taskAffinity
872 + " targetActivity=" + targetActivity
873 + " persistableMode=" + persistableModeToString());
874 }
Dianne Hackborn12527f92009-11-11 17:39:50 -0800875 if (launchMode != 0 || flags != 0 || theme != 0) {
876 pw.println(prefix + "launchMode=" + launchMode
877 + " flags=0x" + Integer.toHexString(flags)
878 + " theme=0x" + Integer.toHexString(theme));
879 }
880 if (screenOrientation != SCREEN_ORIENTATION_UNSPECIFIED
881 || configChanges != 0 || softInputMode != 0) {
882 pw.println(prefix + "screenOrientation=" + screenOrientation
883 + " configChanges=0x" + Integer.toHexString(configChanges)
884 + " softInputMode=0x" + Integer.toHexString(softInputMode));
885 }
Adam Powell269248d2011-08-02 10:26:54 -0700886 if (uiOptions != 0) {
887 pw.println(prefix + " uiOptions=0x" + Integer.toHexString(uiOptions));
888 }
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -0800889 if ((flags&DUMP_FLAG_DETAILS) != 0) {
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -0800890 pw.println(prefix + "lockTaskLaunchMode="
891 + lockTaskLaunchModeToString(lockTaskLaunchMode));
892 }
Andrii Kulian2e751b82016-03-16 16:59:32 -0700893 if (windowLayout != null) {
894 pw.println(prefix + "windowLayout=" + windowLayout.width + "|"
895 + windowLayout.widthFraction + ", " + windowLayout.height + "|"
896 + windowLayout.heightFraction + ", " + windowLayout.gravity);
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -0700897 }
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800898 pw.println(prefix + "resizeMode=" + resizeModeToString(resizeMode));
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -0800899 super.dumpBack(pw, prefix, flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800900 }
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -0700901
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800902 public String toString() {
903 return "ActivityInfo{"
904 + Integer.toHexString(System.identityHashCode(this))
905 + " " + name + "}";
906 }
907
908 public int describeContents() {
909 return 0;
910 }
911
912 public void writeToParcel(Parcel dest, int parcelableFlags) {
913 super.writeToParcel(dest, parcelableFlags);
914 dest.writeInt(theme);
915 dest.writeInt(launchMode);
Robert Carr3e2e0112015-09-15 12:30:42 -0700916 dest.writeInt(documentLaunchMode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800917 dest.writeString(permission);
918 dest.writeString(taskAffinity);
919 dest.writeString(targetActivity);
920 dest.writeInt(flags);
921 dest.writeInt(screenOrientation);
922 dest.writeInt(configChanges);
923 dest.writeInt(softInputMode);
Adam Powell269248d2011-08-02 10:26:54 -0700924 dest.writeInt(uiOptions);
Adam Powelldd8fab22012-03-22 17:47:27 -0700925 dest.writeString(parentActivityName);
Craig Mautner43e52ed2014-06-16 17:18:52 -0700926 dest.writeInt(persistableMode);
Craig Mautner8307ea72014-09-11 15:03:53 -0700927 dest.writeInt(maxRecents);
Craig Mautner15df08a2015-04-01 12:17:18 -0700928 dest.writeInt(lockTaskLaunchMode);
Andrii Kulian2e751b82016-03-16 16:59:32 -0700929 if (windowLayout != null) {
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -0700930 dest.writeInt(1);
Andrii Kulian2e751b82016-03-16 16:59:32 -0700931 dest.writeInt(windowLayout.width);
932 dest.writeFloat(windowLayout.widthFraction);
933 dest.writeInt(windowLayout.height);
934 dest.writeFloat(windowLayout.heightFraction);
935 dest.writeInt(windowLayout.gravity);
936 dest.writeInt(windowLayout.minimalWidth);
937 dest.writeInt(windowLayout.minimalHeight);
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -0700938 } else {
939 dest.writeInt(0);
940 }
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800941 dest.writeInt(resizeMode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800942 }
943
944 public static final Parcelable.Creator<ActivityInfo> CREATOR
945 = new Parcelable.Creator<ActivityInfo>() {
946 public ActivityInfo createFromParcel(Parcel source) {
947 return new ActivityInfo(source);
948 }
949 public ActivityInfo[] newArray(int size) {
950 return new ActivityInfo[size];
951 }
952 };
953
954 private ActivityInfo(Parcel source) {
955 super(source);
956 theme = source.readInt();
957 launchMode = source.readInt();
Robert Carr3e2e0112015-09-15 12:30:42 -0700958 documentLaunchMode = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800959 permission = source.readString();
960 taskAffinity = source.readString();
961 targetActivity = source.readString();
962 flags = source.readInt();
963 screenOrientation = source.readInt();
964 configChanges = source.readInt();
965 softInputMode = source.readInt();
Adam Powell269248d2011-08-02 10:26:54 -0700966 uiOptions = source.readInt();
Adam Powelldd8fab22012-03-22 17:47:27 -0700967 parentActivityName = source.readString();
Craig Mautner43e52ed2014-06-16 17:18:52 -0700968 persistableMode = source.readInt();
Craig Mautner8307ea72014-09-11 15:03:53 -0700969 maxRecents = source.readInt();
Craig Mautner15df08a2015-04-01 12:17:18 -0700970 lockTaskLaunchMode = source.readInt();
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -0700971 if (source.readInt() == 1) {
Andrii Kulian2e751b82016-03-16 16:59:32 -0700972 windowLayout = new WindowLayout(source);
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -0700973 }
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800974 resizeMode = source.readInt();
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -0700975 }
976
Andrii Kulian2e751b82016-03-16 16:59:32 -0700977 /**
978 * Contains information about position and size of the activity on the display.
979 *
980 * Used in freeform mode to set desired position when activity is first launched.
981 * It describes how big the activity wants to be in both width and height,
982 * the minimal allowed size, and the gravity to be applied.
983 *
984 * @attr ref android.R.styleable#AndroidManifestLayout_defaultWidth
985 * @attr ref android.R.styleable#AndroidManifestLayout_defaultHeight
986 * @attr ref android.R.styleable#AndroidManifestLayout_gravity
987 * @attr ref android.R.styleable#AndroidManifestLayout_minimalWidth
988 * @attr ref android.R.styleable#AndroidManifestLayout_minimalHeight
989 */
990 public static final class WindowLayout {
991 public WindowLayout(int width, float widthFraction, int height, float heightFraction, int gravity,
992 int minimalWidth, int minimalHeight) {
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -0700993 this.width = width;
994 this.widthFraction = widthFraction;
995 this.height = height;
996 this.heightFraction = heightFraction;
997 this.gravity = gravity;
Andrii Kulian2e751b82016-03-16 16:59:32 -0700998 this.minimalWidth = minimalWidth;
999 this.minimalHeight = minimalHeight;
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001000 }
1001
Andrii Kulian2e751b82016-03-16 16:59:32 -07001002 WindowLayout(Parcel source) {
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001003 width = source.readInt();
1004 widthFraction = source.readFloat();
1005 height = source.readInt();
1006 heightFraction = source.readFloat();
1007 gravity = source.readInt();
Andrii Kulian2e751b82016-03-16 16:59:32 -07001008 minimalWidth = source.readInt();
1009 minimalHeight = source.readInt();
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001010 }
1011
Andrii Kulian2e751b82016-03-16 16:59:32 -07001012 /**
1013 * Width of activity in pixels.
1014 *
1015 * @attr ref android.R.styleable#AndroidManifestLayout_defaultWidth
1016 */
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001017 public final int width;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001018
1019 /**
1020 * Width of activity as a fraction of available display width.
1021 * If both {@link #width} and this value are set this one will be preferred.
1022 *
1023 * @attr ref android.R.styleable#AndroidManifestLayout_defaultWidth
1024 */
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001025 public final float widthFraction;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001026
1027 /**
1028 * Height of activity in pixels.
1029 *
1030 * @attr ref android.R.styleable#AndroidManifestLayout_defaultHeight
1031 */
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001032 public final int height;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001033
1034 /**
1035 * Height of activity as a fraction of available display height.
1036 * If both {@link #height} and this value are set this one will be preferred.
1037 *
1038 * @attr ref android.R.styleable#AndroidManifestLayout_defaultHeight
1039 */
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001040 public final float heightFraction;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001041
1042 /**
1043 * Gravity of activity.
1044 * Currently {@link android.view.Gravity#TOP}, {@link android.view.Gravity#BOTTOM},
1045 * {@link android.view.Gravity#LEFT} and {@link android.view.Gravity#RIGHT} are supported.
1046 *
1047 * @attr ref android.R.styleable#AndroidManifestLayout_gravity
1048 */
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001049 public final int gravity;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001050
1051 /**
1052 * Minimal width of activity in pixels to be able to display its content.
1053 *
1054 * <p><strong>NOTE:</strong> A task's root activity value is applied to all additional
1055 * activities launched in the task. That is if the root activity of a task set minimal
1056 * width, then the system will set the same minimal width on all other activities in the
1057 * task. It will also ignore any other minimal width attributes of non-root activities.
1058 *
1059 * @attr ref android.R.styleable#AndroidManifestLayout_minimalWidth
1060 */
1061 public final int minimalWidth;
1062
1063 /**
1064 * Minimal height of activity in pixels to be able to display its content.
1065 *
1066 * <p><strong>NOTE:</strong> A task's root activity value is applied to all additional
1067 * activities launched in the task. That is if the root activity of a task set minimal
1068 * height, then the system will set the same minimal height on all other activities in the
1069 * task. It will also ignore any other minimal height attributes of non-root activities.
1070 *
1071 * @attr ref android.R.styleable#AndroidManifestLayout_minimalHeight
1072 */
1073 public final int minimalHeight;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001074 }
1075}