blob: e2ca1ddea37628a22080122e1c56bf79af523606 [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
19import android.os.Parcel;
20import android.os.Parcelable;
21import android.util.Printer;
22
23/**
24 * Information you can retrieve about a particular application
25 * activity or receiver. This corresponds to information collected
26 * from the AndroidManifest.xml's <activity> and
27 * <receiver> tags.
28 */
29public class ActivityInfo extends ComponentInfo
30 implements Parcelable {
31 /**
32 * A style resource identifier (in the package's resources) of this
33 * activity's theme. From the "theme" attribute or, if not set, 0.
34 */
35 public int theme;
36
37 /**
38 * Constant corresponding to <code>standard</code> in
39 * the {@link android.R.attr#launchMode} attribute.
40 */
41 public static final int LAUNCH_MULTIPLE = 0;
42 /**
43 * Constant corresponding to <code>singleTop</code> in
44 * the {@link android.R.attr#launchMode} attribute.
45 */
46 public static final int LAUNCH_SINGLE_TOP = 1;
47 /**
48 * Constant corresponding to <code>singleTask</code> in
49 * the {@link android.R.attr#launchMode} attribute.
50 */
51 public static final int LAUNCH_SINGLE_TASK = 2;
52 /**
53 * Constant corresponding to <code>singleInstance</code> in
54 * the {@link android.R.attr#launchMode} attribute.
55 */
56 public static final int LAUNCH_SINGLE_INSTANCE = 3;
57 /**
58 * The launch mode style requested by the activity. From the
59 * {@link android.R.attr#launchMode} attribute, one of
60 * {@link #LAUNCH_MULTIPLE},
61 * {@link #LAUNCH_SINGLE_TOP}, {@link #LAUNCH_SINGLE_TASK}, or
62 * {@link #LAUNCH_SINGLE_INSTANCE}.
63 */
64 public int launchMode;
65
66 /**
67 * Optional name of a permission required to be able to access this
68 * Activity. From the "permission" attribute.
69 */
70 public String permission;
71
72 /**
73 * The affinity this activity has for another task in the system. The
74 * string here is the name of the task, often the package name of the
75 * overall package. If null, the activity has no affinity. Set from the
76 * {@link android.R.attr#taskAffinity} attribute.
77 */
78 public String taskAffinity;
79
80 /**
81 * If this is an activity alias, this is the real activity class to run
82 * for it. Otherwise, this is null.
83 */
84 public String targetActivity;
85
86 /**
87 * Bit in {@link #flags} indicating whether this activity is able to
88 * run in multiple processes. If
89 * true, the system may instantiate it in the some process as the
90 * process starting it in order to conserve resources. If false, the
91 * default, it always runs in {@link #processName}. Set from the
92 * {@link android.R.attr#multiprocess} attribute.
93 */
94 public static final int FLAG_MULTIPROCESS = 0x0001;
95 /**
96 * Bit in {@link #flags} indicating that, when the activity's task is
97 * relaunched from home, this activity should be finished.
98 * Set from the
99 * {@link android.R.attr#finishOnTaskLaunch} attribute.
100 */
101 public static final int FLAG_FINISH_ON_TASK_LAUNCH = 0x0002;
102 /**
103 * Bit in {@link #flags} indicating that, when the activity is the root
104 * of a task, that task's stack should be cleared each time the user
105 * re-launches it from home. As a result, the user will always
106 * return to the original activity at the top of the task.
107 * This flag only applies to activities that
108 * are used to start the root of a new task. Set from the
109 * {@link android.R.attr#clearTaskOnLaunch} attribute.
110 */
111 public static final int FLAG_CLEAR_TASK_ON_LAUNCH = 0x0004;
112 /**
113 * Bit in {@link #flags} indicating that, when the activity is the root
114 * of a task, that task's stack should never be cleared when it is
115 * relaunched from home. Set from the
116 * {@link android.R.attr#alwaysRetainTaskState} attribute.
117 */
118 public static final int FLAG_ALWAYS_RETAIN_TASK_STATE = 0x0008;
119 /**
120 * Bit in {@link #flags} indicating that the activity's state
121 * is not required to be saved, so that if there is a failure the
122 * activity will not be removed from the activity stack. Set from the
123 * {@link android.R.attr#stateNotNeeded} attribute.
124 */
125 public static final int FLAG_STATE_NOT_NEEDED = 0x0010;
126 /**
127 * Bit in {@link #flags} that indicates that the activity should not
128 * appear in the list of recently launched activities. Set from the
129 * {@link android.R.attr#excludeFromRecents} attribute.
130 */
131 public static final int FLAG_EXCLUDE_FROM_RECENTS = 0x0020;
132 /**
133 * Bit in {@link #flags} that indicates that the activity can be moved
134 * between tasks based on its task affinity. Set from the
135 * {@link android.R.attr#allowTaskReparenting} attribute.
136 */
137 public static final int FLAG_ALLOW_TASK_REPARENTING = 0x0040;
138 /**
139 * Bit in {@link #flags} indicating that, when the user navigates away
140 * from an activity, it should be finished.
141 * Set from the
142 * {@link android.R.attr#noHistory} attribute.
143 */
144 public static final int FLAG_NO_HISTORY = 0x0080;
145 /**
Dianne Hackbornffa42482009-09-23 22:20:11 -0700146 * Bit in {@link #flags} indicating that, when a request to close system
147 * windows happens, this activity is finished.
148 * Set from the
149 * {@link android.R.attr#finishOnCloseSystemDialogs} attribute.
150 */
151 public static final int FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS = 0x0100;
Dianne Hackborn327fbd22011-01-17 14:38:50 -0800152 /**
153 * Value for {@link #flags}: true when the application's rendering should
154 * be hardware accelerated.
155 */
156 public static final int FLAG_HARDWARE_ACCELERATED = 0x0200;
157 /**
Craig Mautner5962b122012-10-05 14:45:52 -0700158 * Value for {@link #flags}: true when the application can be displayed over the lockscreen
159 * and consequently over all users' windows.
160 * @hide
161 */
162 public static final int FLAG_SHOW_ON_LOCK_SCREEN = 0x0400;
163 /**
Dianne Hackborn327fbd22011-01-17 14:38:50 -0800164 * @hide
Daniel Sandler613dde42010-06-21 13:46:39 -0400165 * Bit in {@link #flags} corresponding to an immersive activity
166 * that wishes not to be interrupted by notifications.
167 * Applications that hide the system notification bar with
168 * {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN}
169 * may still be interrupted by high-priority notifications; for example, an
170 * incoming phone call may use
Daniel Sandler8091ca52010-06-22 13:58:46 -0400171 * {@link android.app.Notification#fullScreenIntent fullScreenIntent}
Daniel Sandler613dde42010-06-21 13:46:39 -0400172 * to present a full-screen in-call activity to the user, pausing the
173 * current activity as a side-effect. An activity with
174 * {@link #FLAG_IMMERSIVE} set, however, will not be interrupted; the
175 * notification may be shown in some other way (such as a small floating
176 * "toast" window).
177 * {@see android.app.Notification#FLAG_HIGH_PRIORITY}
178 */
Craig Mautner5962b122012-10-05 14:45:52 -0700179 public static final int FLAG_IMMERSIVE = 0x0800;
Romain Guy529b60a2010-08-03 18:05:47 -0700180 /**
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -0700181 * @hide Bit in {@link #flags}: If set, this component will only be seen
182 * by the primary user. Only works with broadcast receivers. Set from the
183 * {@link android.R.attr#primaryUserOnly} attribute.
184 */
185 public static final int FLAG_PRIMARY_USER_ONLY = 0x20000000;
186 /**
Dianne Hackborn7d19e022012-08-07 19:12:33 -0700187 * Bit in {@link #flags}: If set, a single instance of the receiver will
188 * run for all users on the device. Set from the
189 * {@link android.R.attr#singleUser} attribute. Note that this flag is
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -0700190 * only relevant for ActivityInfo structures that are describing receiver
Dianne Hackborn7d19e022012-08-07 19:12:33 -0700191 * components; it is not applied to activities.
192 */
193 public static final int FLAG_SINGLE_USER = 0x40000000;
194 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800195 * Options that have been set in the activity declaration in the
Daniel Sandler613dde42010-06-21 13:46:39 -0400196 * manifest.
197 * These include:
198 * {@link #FLAG_MULTIPROCESS},
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800199 * {@link #FLAG_FINISH_ON_TASK_LAUNCH}, {@link #FLAG_CLEAR_TASK_ON_LAUNCH},
200 * {@link #FLAG_ALWAYS_RETAIN_TASK_STATE},
201 * {@link #FLAG_STATE_NOT_NEEDED}, {@link #FLAG_EXCLUDE_FROM_RECENTS},
Dianne Hackbornffa42482009-09-23 22:20:11 -0700202 * {@link #FLAG_ALLOW_TASK_REPARENTING}, {@link #FLAG_NO_HISTORY},
Daniel Sandler613dde42010-06-21 13:46:39 -0400203 * {@link #FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS},
Dianne Hackborn7d19e022012-08-07 19:12:33 -0700204 * {@link #FLAG_HARDWARE_ACCELERATED}, {@link #FLAG_SINGLE_USER}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800205 */
206 public int flags;
207
208 /**
209 * Constant corresponding to <code>unspecified</code> in
210 * the {@link android.R.attr#screenOrientation} attribute.
211 */
212 public static final int SCREEN_ORIENTATION_UNSPECIFIED = -1;
213 /**
214 * Constant corresponding to <code>landscape</code> in
215 * the {@link android.R.attr#screenOrientation} attribute.
216 */
217 public static final int SCREEN_ORIENTATION_LANDSCAPE = 0;
218 /**
219 * Constant corresponding to <code>portrait</code> in
220 * the {@link android.R.attr#screenOrientation} attribute.
221 */
222 public static final int SCREEN_ORIENTATION_PORTRAIT = 1;
223 /**
224 * Constant corresponding to <code>user</code> in
225 * the {@link android.R.attr#screenOrientation} attribute.
226 */
227 public static final int SCREEN_ORIENTATION_USER = 2;
228 /**
229 * Constant corresponding to <code>behind</code> in
230 * the {@link android.R.attr#screenOrientation} attribute.
231 */
232 public static final int SCREEN_ORIENTATION_BEHIND = 3;
233 /**
234 * Constant corresponding to <code>sensor</code> in
235 * the {@link android.R.attr#screenOrientation} attribute.
236 */
237 public static final int SCREEN_ORIENTATION_SENSOR = 4;
238
239 /**
Dianne Hackborne5439f22010-10-02 16:53:50 -0700240 * Constant corresponding to <code>nosensor</code> in
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800241 * the {@link android.R.attr#screenOrientation} attribute.
242 */
243 public static final int SCREEN_ORIENTATION_NOSENSOR = 5;
Dianne Hackborne5439f22010-10-02 16:53:50 -0700244
245 /**
246 * Constant corresponding to <code>sensorLandscape</code> in
247 * the {@link android.R.attr#screenOrientation} attribute.
248 */
249 public static final int SCREEN_ORIENTATION_SENSOR_LANDSCAPE = 6;
250
251 /**
252 * Constant corresponding to <code>sensorPortrait</code> in
253 * the {@link android.R.attr#screenOrientation} attribute.
254 */
255 public static final int SCREEN_ORIENTATION_SENSOR_PORTRAIT = 7;
256
257 /**
258 * Constant corresponding to <code>reverseLandscape</code> in
259 * the {@link android.R.attr#screenOrientation} attribute.
260 */
261 public static final int SCREEN_ORIENTATION_REVERSE_LANDSCAPE = 8;
262
263 /**
264 * Constant corresponding to <code>reversePortrait</code> in
265 * the {@link android.R.attr#screenOrientation} attribute.
266 */
267 public static final int SCREEN_ORIENTATION_REVERSE_PORTRAIT = 9;
268
269 /**
270 * Constant corresponding to <code>fullSensor</code> in
271 * the {@link android.R.attr#screenOrientation} attribute.
272 */
273 public static final int SCREEN_ORIENTATION_FULL_SENSOR = 10;
274
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800275 /**
276 * The preferred screen orientation this activity would like to run in.
277 * From the {@link android.R.attr#screenOrientation} attribute, one of
278 * {@link #SCREEN_ORIENTATION_UNSPECIFIED},
279 * {@link #SCREEN_ORIENTATION_LANDSCAPE},
280 * {@link #SCREEN_ORIENTATION_PORTRAIT},
281 * {@link #SCREEN_ORIENTATION_USER},
282 * {@link #SCREEN_ORIENTATION_BEHIND},
283 * {@link #SCREEN_ORIENTATION_SENSOR},
Dianne Hackborne5439f22010-10-02 16:53:50 -0700284 * {@link #SCREEN_ORIENTATION_NOSENSOR},
285 * {@link #SCREEN_ORIENTATION_SENSOR_LANDSCAPE},
286 * {@link #SCREEN_ORIENTATION_SENSOR_PORTRAIT},
287 * {@link #SCREEN_ORIENTATION_REVERSE_LANDSCAPE},
288 * {@link #SCREEN_ORIENTATION_REVERSE_PORTRAIT},
289 * {@link #SCREEN_ORIENTATION_FULL_SENSOR}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800290 */
291 public int screenOrientation = SCREEN_ORIENTATION_UNSPECIFIED;
292
293 /**
294 * Bit in {@link #configChanges} that indicates that the activity
295 * can itself handle changes to the IMSI MCC. Set from the
296 * {@link android.R.attr#configChanges} attribute.
297 */
298 public static final int CONFIG_MCC = 0x0001;
299 /**
300 * Bit in {@link #configChanges} that indicates that the activity
301 * can itself handle changes to the IMSI MNC. Set from the
302 * {@link android.R.attr#configChanges} attribute.
303 */
304 public static final int CONFIG_MNC = 0x0002;
305 /**
306 * Bit in {@link #configChanges} that indicates that the activity
307 * can itself handle changes to the locale. Set from the
308 * {@link android.R.attr#configChanges} attribute.
309 */
310 public static final int CONFIG_LOCALE = 0x0004;
311 /**
312 * Bit in {@link #configChanges} that indicates that the activity
313 * can itself handle changes to the touchscreen type. Set from the
314 * {@link android.R.attr#configChanges} attribute.
315 */
316 public static final int CONFIG_TOUCHSCREEN = 0x0008;
317 /**
318 * Bit in {@link #configChanges} that indicates that the activity
319 * can itself handle changes to the keyboard type. Set from the
320 * {@link android.R.attr#configChanges} attribute.
321 */
322 public static final int CONFIG_KEYBOARD = 0x0010;
323 /**
324 * Bit in {@link #configChanges} that indicates that the activity
Dianne Hackborn93e462b2009-09-15 22:50:40 -0700325 * can itself handle changes to the keyboard or navigation being hidden/exposed.
326 * Note that inspite of the name, this applies to the changes to any
327 * hidden states: keyboard or navigation.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800328 * Set from the {@link android.R.attr#configChanges} attribute.
329 */
330 public static final int CONFIG_KEYBOARD_HIDDEN = 0x0020;
331 /**
332 * Bit in {@link #configChanges} that indicates that the activity
333 * can itself handle changes to the navigation type. Set from the
334 * {@link android.R.attr#configChanges} attribute.
335 */
336 public static final int CONFIG_NAVIGATION = 0x0040;
337 /**
338 * Bit in {@link #configChanges} that indicates that the activity
339 * can itself handle changes to the screen orientation. Set from the
340 * {@link android.R.attr#configChanges} attribute.
341 */
342 public static final int CONFIG_ORIENTATION = 0x0080;
343 /**
344 * Bit in {@link #configChanges} that indicates that the activity
Dianne Hackborn723738c2009-06-25 19:48:04 -0700345 * can itself handle changes to the screen layout. Set from the
346 * {@link android.R.attr#configChanges} attribute.
347 */
348 public static final int CONFIG_SCREEN_LAYOUT = 0x0100;
349 /**
350 * Bit in {@link #configChanges} that indicates that the activity
Tobias Haamel27b28b32010-02-09 23:09:17 +0100351 * can itself handle the ui mode. Set from the
352 * {@link android.R.attr#configChanges} attribute.
Tobias Haamel27b28b32010-02-09 23:09:17 +0100353 */
354 public static final int CONFIG_UI_MODE = 0x0200;
355 /**
356 * Bit in {@link #configChanges} that indicates that the activity
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700357 * can itself handle the screen size. Set from the
Dianne Hackborne6676352011-06-01 16:51:20 -0700358 * {@link android.R.attr#configChanges} attribute. This will be
359 * set by default for applications that target an earlier version
360 * than {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}...
361 * <b>however</b>, you will not see the bit set here becomes some
362 * applications incorrectly compare {@link #configChanges} against
363 * an absolute value rather than correctly masking out the bits
364 * they are interested in. Please don't do that, thanks.
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700365 */
366 public static final int CONFIG_SCREEN_SIZE = 0x0400;
367 /**
368 * Bit in {@link #configChanges} that indicates that the activity
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700369 * can itself handle the smallest screen size. Set from the
Dianne Hackborne6676352011-06-01 16:51:20 -0700370 * {@link android.R.attr#configChanges} attribute. This will be
371 * set by default for applications that target an earlier version
372 * than {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}...
373 * <b>however</b>, you will not see the bit set here becomes some
374 * applications incorrectly compare {@link #configChanges} against
375 * an absolute value rather than correctly masking out the bits
376 * they are interested in. Please don't do that, thanks.
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700377 */
378 public static final int CONFIG_SMALLEST_SCREEN_SIZE = 0x0800;
379 /**
380 * Bit in {@link #configChanges} that indicates that the activity
Dianne Hackborn908aecc2012-07-31 16:37:34 -0700381 * can itself handle density changes. Set from the
382 * {@link android.R.attr#configChanges} attribute.
383 */
384 public static final int CONFIG_DENSITY = 0x1000;
385 /**
386 * Bit in {@link #configChanges} that indicates that the activity
Fabrice Di Meglio5f797992012-06-15 20:16:41 -0700387 * can itself handle the change to layout direction. Set from the
388 * {@link android.R.attr#configChanges} attribute.
389 */
390 public static final int CONFIG_LAYOUT_DIRECTION = 0x2000;
391 /**
392 * Bit in {@link #configChanges} that indicates that the activity
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800393 * can itself handle changes to the font scaling factor. Set from the
394 * {@link android.R.attr#configChanges} attribute. This is
395 * not a core resource configutation, but a higher-level value, so its
396 * constant starts at the high bits.
397 */
398 public static final int CONFIG_FONT_SCALE = 0x40000000;
399
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700400 /** @hide
401 * Unfortunately the constants for config changes in native code are
402 * different from ActivityInfo. :( Here are the values we should use for the
403 * native side given the bit we have assigned in ActivityInfo.
404 */
405 public static int[] CONFIG_NATIVE_BITS = new int[] {
406 0x0001, // MNC
407 0x0002, // MCC
408 0x0004, // LOCALE
409 0x0008, // TOUCH SCREEN
410 0x0010, // KEYBOARD
411 0x0020, // KEYBOARD HIDDEN
412 0x0040, // NAVIGATION
413 0x0080, // ORIENTATION
414 0x0800, // SCREEN LAYOUT
415 0x1000, // UI MODE
416 0x0200, // SCREEN SIZE
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700417 0x2000, // SMALLEST SCREEN SIZE
Dianne Hackborn908aecc2012-07-31 16:37:34 -0700418 0x0100, // DENSITY
Fabrice Di Meglio5f797992012-06-15 20:16:41 -0700419 0x4000, // LAYOUT DIRECTION
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700420 };
421 /** @hide
422 * Convert Java change bits to native.
423 */
424 public static int activityInfoConfigToNative(int input) {
425 int output = 0;
426 for (int i=0; i<CONFIG_NATIVE_BITS.length; i++) {
427 if ((input&(1<<i)) != 0) {
428 output |= CONFIG_NATIVE_BITS[i];
429 }
430 }
431 return output;
432 }
433
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800434 /**
Dianne Hackborne6676352011-06-01 16:51:20 -0700435 * @hide
436 * Unfortunately some developers (OpenFeint I am looking at you) have
437 * compared the configChanges bit field against absolute values, so if we
438 * introduce a new bit they break. To deal with that, we will make sure
439 * the public field will not have a value that breaks them, and let the
440 * framework call here to get the real value.
441 */
442 public int getRealConfigChanged() {
443 return applicationInfo.targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB_MR2
444 ? (configChanges | ActivityInfo.CONFIG_SCREEN_SIZE
445 | ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE)
446 : configChanges;
447 }
448
449 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800450 * Bit mask of kinds of configuration changes that this activity
451 * can handle itself (without being restarted by the system).
452 * Contains any combination of {@link #CONFIG_FONT_SCALE},
453 * {@link #CONFIG_MCC}, {@link #CONFIG_MNC},
454 * {@link #CONFIG_LOCALE}, {@link #CONFIG_TOUCHSCREEN},
Dianne Hackborn723738c2009-06-25 19:48:04 -0700455 * {@link #CONFIG_KEYBOARD}, {@link #CONFIG_NAVIGATION},
Fabrice Di Meglio5f797992012-06-15 20:16:41 -0700456 * {@link #CONFIG_ORIENTATION}, {@link #CONFIG_SCREEN_LAYOUT} and
457 * {@link #CONFIG_LAYOUT_DIRECTION}. Set from the {@link android.R.attr#configChanges}
458 * attribute.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800459 */
460 public int configChanges;
461
462 /**
463 * The desired soft input mode for this activity's main window.
464 * Set from the {@link android.R.attr#windowSoftInputMode} attribute
465 * in the activity's manifest. May be any of the same values allowed
466 * for {@link android.view.WindowManager.LayoutParams#softInputMode
467 * WindowManager.LayoutParams.softInputMode}. If 0 (unspecified),
468 * the mode from the theme will be used.
469 */
470 public int softInputMode;
Adam Powell269248d2011-08-02 10:26:54 -0700471
472 /**
473 * The desired extra UI options for this activity and its main window.
474 * Set from the {@link android.R.attr#uiOptions} attribute in the
475 * activity's manifest.
476 */
477 public int uiOptions = 0;
478
479 /**
Scott Maine797ed62011-09-22 16:17:45 -0700480 * Flag for use with {@link #uiOptions}.
481 * Indicates that the action bar should put all action items in a separate bar when
482 * the screen is narrow.
483 * <p>This value corresponds to "splitActionBarWhenNarrow" for the {@link #uiOptions} XML
484 * attribute.
Adam Powell269248d2011-08-02 10:26:54 -0700485 */
486 public static final int UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW = 1;
487
Adam Powelldd8fab22012-03-22 17:47:27 -0700488 /**
489 * If defined, the activity named here is the logical parent of this activity.
490 */
491 public String parentActivityName;
492
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800493 public ActivityInfo() {
494 }
495
496 public ActivityInfo(ActivityInfo orig) {
497 super(orig);
498 theme = orig.theme;
499 launchMode = orig.launchMode;
500 permission = orig.permission;
501 taskAffinity = orig.taskAffinity;
502 targetActivity = orig.targetActivity;
503 flags = orig.flags;
504 screenOrientation = orig.screenOrientation;
505 configChanges = orig.configChanges;
506 softInputMode = orig.softInputMode;
Adam Powell269248d2011-08-02 10:26:54 -0700507 uiOptions = orig.uiOptions;
Adam Powelldd8fab22012-03-22 17:47:27 -0700508 parentActivityName = orig.parentActivityName;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800509 }
510
511 /**
512 * Return the theme resource identifier to use for this activity. If
513 * the activity defines a theme, that is used; else, the application
514 * theme is used.
515 *
516 * @return The theme associated with this activity.
517 */
518 public final int getThemeResource() {
519 return theme != 0 ? theme : applicationInfo.theme;
520 }
521
522 public void dump(Printer pw, String prefix) {
523 super.dumpFront(pw, prefix);
Dianne Hackborn12527f92009-11-11 17:39:50 -0800524 if (permission != null) {
525 pw.println(prefix + "permission=" + permission);
526 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800527 pw.println(prefix + "taskAffinity=" + taskAffinity
528 + " targetActivity=" + targetActivity);
Dianne Hackborn12527f92009-11-11 17:39:50 -0800529 if (launchMode != 0 || flags != 0 || theme != 0) {
530 pw.println(prefix + "launchMode=" + launchMode
531 + " flags=0x" + Integer.toHexString(flags)
532 + " theme=0x" + Integer.toHexString(theme));
533 }
534 if (screenOrientation != SCREEN_ORIENTATION_UNSPECIFIED
535 || configChanges != 0 || softInputMode != 0) {
536 pw.println(prefix + "screenOrientation=" + screenOrientation
537 + " configChanges=0x" + Integer.toHexString(configChanges)
538 + " softInputMode=0x" + Integer.toHexString(softInputMode));
539 }
Adam Powell269248d2011-08-02 10:26:54 -0700540 if (uiOptions != 0) {
541 pw.println(prefix + " uiOptions=0x" + Integer.toHexString(uiOptions));
542 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800543 super.dumpBack(pw, prefix);
544 }
545
546 public String toString() {
547 return "ActivityInfo{"
548 + Integer.toHexString(System.identityHashCode(this))
549 + " " + name + "}";
550 }
551
552 public int describeContents() {
553 return 0;
554 }
555
556 public void writeToParcel(Parcel dest, int parcelableFlags) {
557 super.writeToParcel(dest, parcelableFlags);
558 dest.writeInt(theme);
559 dest.writeInt(launchMode);
560 dest.writeString(permission);
561 dest.writeString(taskAffinity);
562 dest.writeString(targetActivity);
563 dest.writeInt(flags);
564 dest.writeInt(screenOrientation);
565 dest.writeInt(configChanges);
566 dest.writeInt(softInputMode);
Adam Powell269248d2011-08-02 10:26:54 -0700567 dest.writeInt(uiOptions);
Adam Powelldd8fab22012-03-22 17:47:27 -0700568 dest.writeString(parentActivityName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800569 }
570
571 public static final Parcelable.Creator<ActivityInfo> CREATOR
572 = new Parcelable.Creator<ActivityInfo>() {
573 public ActivityInfo createFromParcel(Parcel source) {
574 return new ActivityInfo(source);
575 }
576 public ActivityInfo[] newArray(int size) {
577 return new ActivityInfo[size];
578 }
579 };
580
581 private ActivityInfo(Parcel source) {
582 super(source);
583 theme = source.readInt();
584 launchMode = source.readInt();
585 permission = source.readString();
586 taskAffinity = source.readString();
587 targetActivity = source.readString();
588 flags = source.readInt();
589 screenOrientation = source.readInt();
590 configChanges = source.readInt();
591 softInputMode = source.readInt();
Adam Powell269248d2011-08-02 10:26:54 -0700592 uiOptions = source.readInt();
Adam Powelldd8fab22012-03-22 17:47:27 -0700593 parentActivityName = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800594 }
595}