Home | History | Annotate | Download | only in pm
      1 /*
      2  * Copyright (C) 2007 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package android.content.pm;
     18 
     19 import android.os.Parcel;
     20 import android.os.Parcelable;
     21 import 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  */
     29 public 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     /**
    146      * 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;
    152     /**
    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     /**
    158      * 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     /**
    164      * Bit in {@link #flags} corresponding to an immersive activity
    165      * that wishes not to be interrupted by notifications.
    166      * Applications that hide the system notification bar with
    167      * {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN}
    168      * may still be interrupted by high-priority notifications; for example, an
    169      * incoming phone call may use
    170      * {@link android.app.Notification#fullScreenIntent fullScreenIntent}
    171      * to present a full-screen in-call activity to the user, pausing the
    172      * current activity as a side-effect. An activity with
    173      * {@link #FLAG_IMMERSIVE} set, however, will not be interrupted; the
    174      * notification may be shown in some other way (such as a small floating
    175      * "toast" window).
    176      *
    177      * Note that this flag will always reflect the Activity's
    178      * <code>android:immersive</code> manifest definition, even if the Activity's
    179      * immersive state is changed at runtime via
    180      * {@link android.app.Activity#setImmersive(boolean)}.
    181      *
    182      * @see android.app.Notification#FLAG_HIGH_PRIORITY
    183      * @see android.app.Activity#setImmersive(boolean)
    184      */
    185     public static final int FLAG_IMMERSIVE = 0x0800;
    186     /**
    187      * @hide Bit in {@link #flags}: If set, this component will only be seen
    188      * by the primary user.  Only works with broadcast receivers.  Set from the
    189      * {@link android.R.attr#primaryUserOnly} attribute.
    190      */
    191     public static final int FLAG_PRIMARY_USER_ONLY = 0x20000000;
    192     /**
    193      * Bit in {@link #flags}: If set, a single instance of the receiver will
    194      * run for all users on the device.  Set from the
    195      * {@link android.R.attr#singleUser} attribute.  Note that this flag is
    196      * only relevant for ActivityInfo structures that are describing receiver
    197      * components; it is not applied to activities.
    198      */
    199     public static final int FLAG_SINGLE_USER = 0x40000000;
    200     /**
    201      * Options that have been set in the activity declaration in the
    202      * manifest.
    203      * These include:
    204      * {@link #FLAG_MULTIPROCESS},
    205      * {@link #FLAG_FINISH_ON_TASK_LAUNCH}, {@link #FLAG_CLEAR_TASK_ON_LAUNCH},
    206      * {@link #FLAG_ALWAYS_RETAIN_TASK_STATE},
    207      * {@link #FLAG_STATE_NOT_NEEDED}, {@link #FLAG_EXCLUDE_FROM_RECENTS},
    208      * {@link #FLAG_ALLOW_TASK_REPARENTING}, {@link #FLAG_NO_HISTORY},
    209      * {@link #FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS},
    210      * {@link #FLAG_HARDWARE_ACCELERATED}, {@link #FLAG_SINGLE_USER}.
    211      */
    212     public int flags;
    213 
    214     /**
    215      * Constant corresponding to <code>unspecified</code> in
    216      * the {@link android.R.attr#screenOrientation} attribute.
    217      */
    218     public static final int SCREEN_ORIENTATION_UNSPECIFIED = -1;
    219     /**
    220      * Constant corresponding to <code>landscape</code> in
    221      * the {@link android.R.attr#screenOrientation} attribute.
    222      */
    223     public static final int SCREEN_ORIENTATION_LANDSCAPE = 0;
    224     /**
    225      * Constant corresponding to <code>portrait</code> in
    226      * the {@link android.R.attr#screenOrientation} attribute.
    227      */
    228     public static final int SCREEN_ORIENTATION_PORTRAIT = 1;
    229     /**
    230      * Constant corresponding to <code>user</code> in
    231      * the {@link android.R.attr#screenOrientation} attribute.
    232      */
    233     public static final int SCREEN_ORIENTATION_USER = 2;
    234     /**
    235      * Constant corresponding to <code>behind</code> in
    236      * the {@link android.R.attr#screenOrientation} attribute.
    237      */
    238     public static final int SCREEN_ORIENTATION_BEHIND = 3;
    239     /**
    240      * Constant corresponding to <code>sensor</code> in
    241      * the {@link android.R.attr#screenOrientation} attribute.
    242      */
    243     public static final int SCREEN_ORIENTATION_SENSOR = 4;
    244 
    245     /**
    246      * Constant corresponding to <code>nosensor</code> in
    247      * the {@link android.R.attr#screenOrientation} attribute.
    248      */
    249     public static final int SCREEN_ORIENTATION_NOSENSOR = 5;
    250 
    251     /**
    252      * Constant corresponding to <code>sensorLandscape</code> in
    253      * the {@link android.R.attr#screenOrientation} attribute.
    254      */
    255     public static final int SCREEN_ORIENTATION_SENSOR_LANDSCAPE = 6;
    256 
    257     /**
    258      * Constant corresponding to <code>sensorPortrait</code> in
    259      * the {@link android.R.attr#screenOrientation} attribute.
    260      */
    261     public static final int SCREEN_ORIENTATION_SENSOR_PORTRAIT = 7;
    262 
    263     /**
    264      * Constant corresponding to <code>reverseLandscape</code> in
    265      * the {@link android.R.attr#screenOrientation} attribute.
    266      */
    267     public static final int SCREEN_ORIENTATION_REVERSE_LANDSCAPE = 8;
    268 
    269     /**
    270      * Constant corresponding to <code>reversePortrait</code> in
    271      * the {@link android.R.attr#screenOrientation} attribute.
    272      */
    273     public static final int SCREEN_ORIENTATION_REVERSE_PORTRAIT = 9;
    274 
    275     /**
    276      * Constant corresponding to <code>fullSensor</code> in
    277      * the {@link android.R.attr#screenOrientation} attribute.
    278      */
    279     public static final int SCREEN_ORIENTATION_FULL_SENSOR = 10;
    280 
    281     /**
    282      * Constant corresponding to <code>userLandscape</code> in
    283      * the {@link android.R.attr#screenOrientation} attribute.
    284      */
    285     public static final int SCREEN_ORIENTATION_USER_LANDSCAPE = 11;
    286 
    287     /**
    288      * Constant corresponding to <code>userPortrait</code> in
    289      * the {@link android.R.attr#screenOrientation} attribute.
    290      */
    291     public static final int SCREEN_ORIENTATION_USER_PORTRAIT = 12;
    292 
    293     /**
    294      * Constant corresponding to <code>fullUser</code> in
    295      * the {@link android.R.attr#screenOrientation} attribute.
    296      */
    297     public static final int SCREEN_ORIENTATION_FULL_USER = 13;
    298 
    299     /**
    300      * Constant corresponding to <code>locked</code> in
    301      * the {@link android.R.attr#screenOrientation} attribute.
    302      */
    303     public static final int SCREEN_ORIENTATION_LOCKED = 14;
    304 
    305     /**
    306      * The preferred screen orientation this activity would like to run in.
    307      * From the {@link android.R.attr#screenOrientation} attribute, one of
    308      * {@link #SCREEN_ORIENTATION_UNSPECIFIED},
    309      * {@link #SCREEN_ORIENTATION_LANDSCAPE},
    310      * {@link #SCREEN_ORIENTATION_PORTRAIT},
    311      * {@link #SCREEN_ORIENTATION_USER},
    312      * {@link #SCREEN_ORIENTATION_BEHIND},
    313      * {@link #SCREEN_ORIENTATION_SENSOR},
    314      * {@link #SCREEN_ORIENTATION_NOSENSOR},
    315      * {@link #SCREEN_ORIENTATION_SENSOR_LANDSCAPE},
    316      * {@link #SCREEN_ORIENTATION_SENSOR_PORTRAIT},
    317      * {@link #SCREEN_ORIENTATION_REVERSE_LANDSCAPE},
    318      * {@link #SCREEN_ORIENTATION_REVERSE_PORTRAIT},
    319      * {@link #SCREEN_ORIENTATION_FULL_SENSOR},
    320      * {@link #SCREEN_ORIENTATION_USER_LANDSCAPE},
    321      * {@link #SCREEN_ORIENTATION_USER_PORTRAIT},
    322      * {@link #SCREEN_ORIENTATION_FULL_USER},
    323      * {@link #SCREEN_ORIENTATION_LOCKED},
    324      */
    325     public int screenOrientation = SCREEN_ORIENTATION_UNSPECIFIED;
    326 
    327     /**
    328      * Bit in {@link #configChanges} that indicates that the activity
    329      * can itself handle changes to the IMSI MCC.  Set from the
    330      * {@link android.R.attr#configChanges} attribute.
    331      */
    332     public static final int CONFIG_MCC = 0x0001;
    333     /**
    334      * Bit in {@link #configChanges} that indicates that the activity
    335      * can itself handle changes to the IMSI MNC.  Set from the
    336      * {@link android.R.attr#configChanges} attribute.
    337      */
    338     public static final int CONFIG_MNC = 0x0002;
    339     /**
    340      * Bit in {@link #configChanges} that indicates that the activity
    341      * can itself handle changes to the locale.  Set from the
    342      * {@link android.R.attr#configChanges} attribute.
    343      */
    344     public static final int CONFIG_LOCALE = 0x0004;
    345     /**
    346      * Bit in {@link #configChanges} that indicates that the activity
    347      * can itself handle changes to the touchscreen type.  Set from the
    348      * {@link android.R.attr#configChanges} attribute.
    349      */
    350     public static final int CONFIG_TOUCHSCREEN = 0x0008;
    351     /**
    352      * Bit in {@link #configChanges} that indicates that the activity
    353      * can itself handle changes to the keyboard type.  Set from the
    354      * {@link android.R.attr#configChanges} attribute.
    355      */
    356     public static final int CONFIG_KEYBOARD = 0x0010;
    357     /**
    358      * Bit in {@link #configChanges} that indicates that the activity
    359      * can itself handle changes to the keyboard or navigation being hidden/exposed.
    360      * Note that inspite of the name, this applies to the changes to any
    361      * hidden states: keyboard or navigation.
    362      * Set from the {@link android.R.attr#configChanges} attribute.
    363      */
    364     public static final int CONFIG_KEYBOARD_HIDDEN = 0x0020;
    365     /**
    366      * Bit in {@link #configChanges} that indicates that the activity
    367      * can itself handle changes to the navigation type.  Set from the
    368      * {@link android.R.attr#configChanges} attribute.
    369      */
    370     public static final int CONFIG_NAVIGATION = 0x0040;
    371     /**
    372      * Bit in {@link #configChanges} that indicates that the activity
    373      * can itself handle changes to the screen orientation.  Set from the
    374      * {@link android.R.attr#configChanges} attribute.
    375      */
    376     public static final int CONFIG_ORIENTATION = 0x0080;
    377     /**
    378      * Bit in {@link #configChanges} that indicates that the activity
    379      * can itself handle changes to the screen layout.  Set from the
    380      * {@link android.R.attr#configChanges} attribute.
    381      */
    382     public static final int CONFIG_SCREEN_LAYOUT = 0x0100;
    383     /**
    384      * Bit in {@link #configChanges} that indicates that the activity
    385      * can itself handle the ui mode. Set from the
    386      * {@link android.R.attr#configChanges} attribute.
    387      */
    388     public static final int CONFIG_UI_MODE = 0x0200;
    389     /**
    390      * Bit in {@link #configChanges} that indicates that the activity
    391      * can itself handle the screen size. Set from the
    392      * {@link android.R.attr#configChanges} attribute.  This will be
    393      * set by default for applications that target an earlier version
    394      * than {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}...
    395      * <b>however</b>, you will not see the bit set here becomes some
    396      * applications incorrectly compare {@link #configChanges} against
    397      * an absolute value rather than correctly masking out the bits
    398      * they are interested in.  Please don't do that, thanks.
    399      */
    400     public static final int CONFIG_SCREEN_SIZE = 0x0400;
    401     /**
    402      * Bit in {@link #configChanges} that indicates that the activity
    403      * can itself handle the smallest screen size. Set from the
    404      * {@link android.R.attr#configChanges} attribute.  This will be
    405      * set by default for applications that target an earlier version
    406      * than {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}...
    407      * <b>however</b>, you will not see the bit set here becomes some
    408      * applications incorrectly compare {@link #configChanges} against
    409      * an absolute value rather than correctly masking out the bits
    410      * they are interested in.  Please don't do that, thanks.
    411      */
    412     public static final int CONFIG_SMALLEST_SCREEN_SIZE = 0x0800;
    413     /**
    414      * Bit in {@link #configChanges} that indicates that the activity
    415      * can itself handle density changes. Set from the
    416      * {@link android.R.attr#configChanges} attribute.
    417      */
    418     public static final int CONFIG_DENSITY = 0x1000;
    419     /**
    420      * Bit in {@link #configChanges} that indicates that the activity
    421      * can itself handle the change to layout direction. Set from the
    422      * {@link android.R.attr#configChanges} attribute.
    423      */
    424     public static final int CONFIG_LAYOUT_DIRECTION = 0x2000;
    425     /**
    426      * Bit in {@link #configChanges} that indicates that the activity
    427      * can itself handle changes to the font scaling factor.  Set from the
    428      * {@link android.R.attr#configChanges} attribute.  This is
    429      * not a core resource configuration, but a higher-level value, so its
    430      * constant starts at the high bits.
    431      */
    432     public static final int CONFIG_FONT_SCALE = 0x40000000;
    433 
    434     /** @hide
    435      * Unfortunately the constants for config changes in native code are
    436      * different from ActivityInfo. :(  Here are the values we should use for the
    437      * native side given the bit we have assigned in ActivityInfo.
    438      */
    439     public static int[] CONFIG_NATIVE_BITS = new int[] {
    440         0x0001, // MNC
    441         0x0002, // MCC
    442         0x0004, // LOCALE
    443         0x0008, // TOUCH SCREEN
    444         0x0010, // KEYBOARD
    445         0x0020, // KEYBOARD HIDDEN
    446         0x0040, // NAVIGATION
    447         0x0080, // ORIENTATION
    448         0x0800, // SCREEN LAYOUT
    449         0x1000, // UI MODE
    450         0x0200, // SCREEN SIZE
    451         0x2000, // SMALLEST SCREEN SIZE
    452         0x0100, // DENSITY
    453         0x4000, // LAYOUT DIRECTION
    454     };
    455     /** @hide
    456      * Convert Java change bits to native.
    457      */
    458     public static int activityInfoConfigToNative(int input) {
    459         int output = 0;
    460         for (int i=0; i<CONFIG_NATIVE_BITS.length; i++) {
    461             if ((input&(1<<i)) != 0) {
    462                 output |= CONFIG_NATIVE_BITS[i];
    463             }
    464         }
    465         return output;
    466     }
    467 
    468     /**
    469      * @hide
    470      * Unfortunately some developers (OpenFeint I am looking at you) have
    471      * compared the configChanges bit field against absolute values, so if we
    472      * introduce a new bit they break.  To deal with that, we will make sure
    473      * the public field will not have a value that breaks them, and let the
    474      * framework call here to get the real value.
    475      */
    476     public int getRealConfigChanged() {
    477         return applicationInfo.targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB_MR2
    478                 ? (configChanges | ActivityInfo.CONFIG_SCREEN_SIZE
    479                         | ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE)
    480                 : configChanges;
    481     }
    482 
    483     /**
    484      * Bit mask of kinds of configuration changes that this activity
    485      * can handle itself (without being restarted by the system).
    486      * Contains any combination of {@link #CONFIG_FONT_SCALE},
    487      * {@link #CONFIG_MCC}, {@link #CONFIG_MNC},
    488      * {@link #CONFIG_LOCALE}, {@link #CONFIG_TOUCHSCREEN},
    489      * {@link #CONFIG_KEYBOARD}, {@link #CONFIG_NAVIGATION},
    490      * {@link #CONFIG_ORIENTATION}, {@link #CONFIG_SCREEN_LAYOUT} and
    491      * {@link #CONFIG_LAYOUT_DIRECTION}.  Set from the {@link android.R.attr#configChanges}
    492      * attribute.
    493      */
    494     public int configChanges;
    495 
    496     /**
    497      * The desired soft input mode for this activity's main window.
    498      * Set from the {@link android.R.attr#windowSoftInputMode} attribute
    499      * in the activity's manifest.  May be any of the same values allowed
    500      * for {@link android.view.WindowManager.LayoutParams#softInputMode
    501      * WindowManager.LayoutParams.softInputMode}.  If 0 (unspecified),
    502      * the mode from the theme will be used.
    503      */
    504     public int softInputMode;
    505 
    506     /**
    507      * The desired extra UI options for this activity and its main window.
    508      * Set from the {@link android.R.attr#uiOptions} attribute in the
    509      * activity's manifest.
    510      */
    511     public int uiOptions = 0;
    512 
    513     /**
    514      * Flag for use with {@link #uiOptions}.
    515      * Indicates that the action bar should put all action items in a separate bar when
    516      * the screen is narrow.
    517      * <p>This value corresponds to "splitActionBarWhenNarrow" for the {@link #uiOptions} XML
    518      * attribute.
    519      */
    520     public static final int UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW = 1;
    521 
    522     /**
    523      * If defined, the activity named here is the logical parent of this activity.
    524      */
    525     public String parentActivityName;
    526 
    527     public ActivityInfo() {
    528     }
    529 
    530     public ActivityInfo(ActivityInfo orig) {
    531         super(orig);
    532         theme = orig.theme;
    533         launchMode = orig.launchMode;
    534         permission = orig.permission;
    535         taskAffinity = orig.taskAffinity;
    536         targetActivity = orig.targetActivity;
    537         flags = orig.flags;
    538         screenOrientation = orig.screenOrientation;
    539         configChanges = orig.configChanges;
    540         softInputMode = orig.softInputMode;
    541         uiOptions = orig.uiOptions;
    542         parentActivityName = orig.parentActivityName;
    543     }
    544 
    545     /**
    546      * Return the theme resource identifier to use for this activity.  If
    547      * the activity defines a theme, that is used; else, the application
    548      * theme is used.
    549      *
    550      * @return The theme associated with this activity.
    551      */
    552     public final int getThemeResource() {
    553         return theme != 0 ? theme : applicationInfo.theme;
    554     }
    555 
    556     public void dump(Printer pw, String prefix) {
    557         super.dumpFront(pw, prefix);
    558         if (permission != null) {
    559             pw.println(prefix + "permission=" + permission);
    560         }
    561         pw.println(prefix + "taskAffinity=" + taskAffinity
    562                 + " targetActivity=" + targetActivity);
    563         if (launchMode != 0 || flags != 0 || theme != 0) {
    564             pw.println(prefix + "launchMode=" + launchMode
    565                     + " flags=0x" + Integer.toHexString(flags)
    566                     + " theme=0x" + Integer.toHexString(theme));
    567         }
    568         if (screenOrientation != SCREEN_ORIENTATION_UNSPECIFIED
    569                 || configChanges != 0 || softInputMode != 0) {
    570             pw.println(prefix + "screenOrientation=" + screenOrientation
    571                     + " configChanges=0x" + Integer.toHexString(configChanges)
    572                     + " softInputMode=0x" + Integer.toHexString(softInputMode));
    573         }
    574         if (uiOptions != 0) {
    575             pw.println(prefix + " uiOptions=0x" + Integer.toHexString(uiOptions));
    576         }
    577         super.dumpBack(pw, prefix);
    578     }
    579 
    580     public String toString() {
    581         return "ActivityInfo{"
    582             + Integer.toHexString(System.identityHashCode(this))
    583             + " " + name + "}";
    584     }
    585 
    586     public int describeContents() {
    587         return 0;
    588     }
    589 
    590     public void writeToParcel(Parcel dest, int parcelableFlags) {
    591         super.writeToParcel(dest, parcelableFlags);
    592         dest.writeInt(theme);
    593         dest.writeInt(launchMode);
    594         dest.writeString(permission);
    595         dest.writeString(taskAffinity);
    596         dest.writeString(targetActivity);
    597         dest.writeInt(flags);
    598         dest.writeInt(screenOrientation);
    599         dest.writeInt(configChanges);
    600         dest.writeInt(softInputMode);
    601         dest.writeInt(uiOptions);
    602         dest.writeString(parentActivityName);
    603     }
    604 
    605     public static final Parcelable.Creator<ActivityInfo> CREATOR
    606             = new Parcelable.Creator<ActivityInfo>() {
    607         public ActivityInfo createFromParcel(Parcel source) {
    608             return new ActivityInfo(source);
    609         }
    610         public ActivityInfo[] newArray(int size) {
    611             return new ActivityInfo[size];
    612         }
    613     };
    614 
    615     private ActivityInfo(Parcel source) {
    616         super(source);
    617         theme = source.readInt();
    618         launchMode = source.readInt();
    619         permission = source.readString();
    620         taskAffinity = source.readString();
    621         targetActivity = source.readString();
    622         flags = source.readInt();
    623         screenOrientation = source.readInt();
    624         configChanges = source.readInt();
    625         softInputMode = source.readInt();
    626         uiOptions = source.readInt();
    627         parentActivityName = source.readString();
    628     }
    629 }
    630