Kenny Root | 15a4d2f | 2010-03-11 18:20:12 -0800 | [diff] [blame] | 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 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 17 | package android.content.pm; |
| 18 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 19 | import android.annotation.IntDef; |
Dianne Hackborn | 1d0b177 | 2013-09-06 14:02:54 -0700 | [diff] [blame] | 20 | import android.content.res.Configuration; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 21 | import android.os.Parcel; |
| 22 | import android.os.Parcelable; |
| 23 | import android.util.Printer; |
| 24 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 25 | import java.lang.annotation.Retention; |
| 26 | import java.lang.annotation.RetentionPolicy; |
| 27 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 28 | /** |
| 29 | * Information you can retrieve about a particular application |
| 30 | * activity or receiver. This corresponds to information collected |
| 31 | * from the AndroidManifest.xml's <activity> and |
| 32 | * <receiver> tags. |
| 33 | */ |
| 34 | public class ActivityInfo extends ComponentInfo |
| 35 | implements Parcelable { |
| 36 | /** |
| 37 | * A style resource identifier (in the package's resources) of this |
| 38 | * activity's theme. From the "theme" attribute or, if not set, 0. |
| 39 | */ |
| 40 | public int theme; |
| 41 | |
| 42 | /** |
| 43 | * Constant corresponding to <code>standard</code> in |
| 44 | * the {@link android.R.attr#launchMode} attribute. |
| 45 | */ |
| 46 | public static final int LAUNCH_MULTIPLE = 0; |
| 47 | /** |
| 48 | * Constant corresponding to <code>singleTop</code> in |
| 49 | * the {@link android.R.attr#launchMode} attribute. |
| 50 | */ |
| 51 | public static final int LAUNCH_SINGLE_TOP = 1; |
| 52 | /** |
| 53 | * Constant corresponding to <code>singleTask</code> in |
| 54 | * the {@link android.R.attr#launchMode} attribute. |
| 55 | */ |
| 56 | public static final int LAUNCH_SINGLE_TASK = 2; |
| 57 | /** |
| 58 | * Constant corresponding to <code>singleInstance</code> in |
| 59 | * the {@link android.R.attr#launchMode} attribute. |
| 60 | */ |
| 61 | public static final int LAUNCH_SINGLE_INSTANCE = 3; |
| 62 | /** |
| 63 | * The launch mode style requested by the activity. From the |
| 64 | * {@link android.R.attr#launchMode} attribute, one of |
| 65 | * {@link #LAUNCH_MULTIPLE}, |
| 66 | * {@link #LAUNCH_SINGLE_TOP}, {@link #LAUNCH_SINGLE_TASK}, or |
| 67 | * {@link #LAUNCH_SINGLE_INSTANCE}. |
| 68 | */ |
| 69 | public int launchMode; |
Craig Mautner | 2dac056 | 2014-05-06 09:06:44 -0700 | [diff] [blame] | 70 | |
| 71 | /** |
| 72 | * Constant corresponding to <code>none</code> in |
| 73 | * the {@link android.R.attr#documentLaunchMode} attribute. |
| 74 | */ |
| 75 | public static final int DOCUMENT_LAUNCH_NONE = 0; |
| 76 | /** |
| 77 | * Constant corresponding to <code>intoExisting</code> in |
| 78 | * the {@link android.R.attr#documentLaunchMode} attribute. |
| 79 | */ |
| 80 | public static final int DOCUMENT_LAUNCH_INTO_EXISTING = 1; |
| 81 | /** |
| 82 | * Constant corresponding to <code>always</code> in |
| 83 | * the {@link android.R.attr#documentLaunchMode} attribute. |
| 84 | */ |
| 85 | public static final int DOCUMENT_LAUNCH_ALWAYS = 2; |
| 86 | /** |
Craig Mautner | f357c0c | 2014-06-09 09:23:27 -0700 | [diff] [blame] | 87 | * Constant corresponding to <code>never</code> in |
| 88 | * the {@link android.R.attr#documentLaunchMode} attribute. |
| 89 | */ |
| 90 | public static final int DOCUMENT_LAUNCH_NEVER = 3; |
| 91 | /** |
Craig Mautner | 2dac056 | 2014-05-06 09:06:44 -0700 | [diff] [blame] | 92 | * The document launch mode style requested by the activity. From the |
| 93 | * {@link android.R.attr#documentLaunchMode} attribute, one of |
| 94 | * {@link #DOCUMENT_LAUNCH_NONE}, {@link #DOCUMENT_LAUNCH_INTO_EXISTING}, |
| 95 | * {@link #DOCUMENT_LAUNCH_ALWAYS}. |
| 96 | * |
| 97 | * <p>Modes DOCUMENT_LAUNCH_ALWAYS |
| 98 | * and DOCUMENT_LAUNCH_INTO_EXISTING are equivalent to {@link |
| 99 | * android.content.Intent#FLAG_ACTIVITY_NEW_DOCUMENT |
| 100 | * Intent.FLAG_ACTIVITY_NEW_DOCUMENT} with and without {@link |
| 101 | * android.content.Intent#FLAG_ACTIVITY_MULTIPLE_TASK |
| 102 | * Intent.FLAG_ACTIVITY_MULTIPLE_TASK} respectively. |
| 103 | */ |
| 104 | public int documentLaunchMode; |
| 105 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 106 | /** |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 107 | * Constant corresponding to <code>persistRootOnly</code> in |
| 108 | * the {@link android.R.attr#persistableMode} attribute. |
| 109 | */ |
| 110 | public static final int PERSIST_ROOT_ONLY = 0; |
| 111 | /** |
| 112 | * Constant corresponding to <code>doNotPersist</code> in |
| 113 | * the {@link android.R.attr#persistableMode} attribute. |
| 114 | */ |
Craig Mautner | 7f72f53 | 2014-07-21 10:07:12 -0700 | [diff] [blame] | 115 | public static final int PERSIST_NEVER = 1; |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 116 | /** |
| 117 | * Constant corresponding to <code>persistAcrossReboots</code> in |
| 118 | * the {@link android.R.attr#persistableMode} attribute. |
| 119 | */ |
| 120 | public static final int PERSIST_ACROSS_REBOOTS = 2; |
| 121 | /** |
| 122 | * Value indicating how this activity is to be persisted across |
| 123 | * reboots for restoring in the Recents list. |
| 124 | * {@link android.R.attr#persistableMode} |
| 125 | */ |
| 126 | public int persistableMode; |
| 127 | |
| 128 | /** |
Craig Mautner | ffcfcaa | 2014-06-05 09:54:38 -0700 | [diff] [blame] | 129 | * The maximum number of tasks rooted at this activity that can be in the recent task list. |
| 130 | * Refer to {@link android.R.attr#maxRecents}. |
| 131 | */ |
| 132 | public int maxRecents; |
| 133 | |
| 134 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 135 | * Optional name of a permission required to be able to access this |
| 136 | * Activity. From the "permission" attribute. |
| 137 | */ |
| 138 | public String permission; |
| 139 | |
| 140 | /** |
| 141 | * The affinity this activity has for another task in the system. The |
| 142 | * string here is the name of the task, often the package name of the |
| 143 | * overall package. If null, the activity has no affinity. Set from the |
| 144 | * {@link android.R.attr#taskAffinity} attribute. |
| 145 | */ |
| 146 | public String taskAffinity; |
| 147 | |
| 148 | /** |
| 149 | * If this is an activity alias, this is the real activity class to run |
| 150 | * for it. Otherwise, this is null. |
| 151 | */ |
| 152 | public String targetActivity; |
| 153 | |
| 154 | /** |
| 155 | * Bit in {@link #flags} indicating whether this activity is able to |
| 156 | * run in multiple processes. If |
| 157 | * true, the system may instantiate it in the some process as the |
| 158 | * process starting it in order to conserve resources. If false, the |
| 159 | * default, it always runs in {@link #processName}. Set from the |
| 160 | * {@link android.R.attr#multiprocess} attribute. |
| 161 | */ |
| 162 | public static final int FLAG_MULTIPROCESS = 0x0001; |
| 163 | /** |
| 164 | * Bit in {@link #flags} indicating that, when the activity's task is |
| 165 | * relaunched from home, this activity should be finished. |
| 166 | * Set from the |
| 167 | * {@link android.R.attr#finishOnTaskLaunch} attribute. |
| 168 | */ |
| 169 | public static final int FLAG_FINISH_ON_TASK_LAUNCH = 0x0002; |
| 170 | /** |
| 171 | * Bit in {@link #flags} indicating that, when the activity is the root |
| 172 | * of a task, that task's stack should be cleared each time the user |
| 173 | * re-launches it from home. As a result, the user will always |
| 174 | * return to the original activity at the top of the task. |
| 175 | * This flag only applies to activities that |
| 176 | * are used to start the root of a new task. Set from the |
| 177 | * {@link android.R.attr#clearTaskOnLaunch} attribute. |
| 178 | */ |
| 179 | public static final int FLAG_CLEAR_TASK_ON_LAUNCH = 0x0004; |
| 180 | /** |
| 181 | * Bit in {@link #flags} indicating that, when the activity is the root |
| 182 | * of a task, that task's stack should never be cleared when it is |
| 183 | * relaunched from home. Set from the |
| 184 | * {@link android.R.attr#alwaysRetainTaskState} attribute. |
| 185 | */ |
| 186 | public static final int FLAG_ALWAYS_RETAIN_TASK_STATE = 0x0008; |
| 187 | /** |
| 188 | * Bit in {@link #flags} indicating that the activity's state |
| 189 | * is not required to be saved, so that if there is a failure the |
| 190 | * activity will not be removed from the activity stack. Set from the |
| 191 | * {@link android.R.attr#stateNotNeeded} attribute. |
| 192 | */ |
| 193 | public static final int FLAG_STATE_NOT_NEEDED = 0x0010; |
| 194 | /** |
| 195 | * Bit in {@link #flags} that indicates that the activity should not |
| 196 | * appear in the list of recently launched activities. Set from the |
| 197 | * {@link android.R.attr#excludeFromRecents} attribute. |
| 198 | */ |
| 199 | public static final int FLAG_EXCLUDE_FROM_RECENTS = 0x0020; |
| 200 | /** |
| 201 | * Bit in {@link #flags} that indicates that the activity can be moved |
| 202 | * between tasks based on its task affinity. Set from the |
| 203 | * {@link android.R.attr#allowTaskReparenting} attribute. |
| 204 | */ |
| 205 | public static final int FLAG_ALLOW_TASK_REPARENTING = 0x0040; |
| 206 | /** |
| 207 | * Bit in {@link #flags} indicating that, when the user navigates away |
| 208 | * from an activity, it should be finished. |
| 209 | * Set from the |
| 210 | * {@link android.R.attr#noHistory} attribute. |
| 211 | */ |
| 212 | public static final int FLAG_NO_HISTORY = 0x0080; |
| 213 | /** |
Dianne Hackborn | ffa4248 | 2009-09-23 22:20:11 -0700 | [diff] [blame] | 214 | * Bit in {@link #flags} indicating that, when a request to close system |
| 215 | * windows happens, this activity is finished. |
| 216 | * Set from the |
| 217 | * {@link android.R.attr#finishOnCloseSystemDialogs} attribute. |
| 218 | */ |
| 219 | public static final int FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS = 0x0100; |
Dianne Hackborn | 327fbd2 | 2011-01-17 14:38:50 -0800 | [diff] [blame] | 220 | /** |
| 221 | * Value for {@link #flags}: true when the application's rendering should |
| 222 | * be hardware accelerated. |
| 223 | */ |
| 224 | public static final int FLAG_HARDWARE_ACCELERATED = 0x0200; |
| 225 | /** |
Wale Ogunwale | 6dfdfd6 | 2015-04-15 12:01:38 -0700 | [diff] [blame] | 226 | * Value for {@link #flags}: true when the application can be displayed for all users |
| 227 | * regardless of if the user of the application is the current user. Set from the |
| 228 | * {@link android.R.attr#showForAllUsers} attribute. |
Craig Mautner | 5962b12 | 2012-10-05 14:45:52 -0700 | [diff] [blame] | 229 | * @hide |
| 230 | */ |
Wale Ogunwale | 6dfdfd6 | 2015-04-15 12:01:38 -0700 | [diff] [blame] | 231 | public static final int FLAG_SHOW_FOR_ALL_USERS = 0x0400; |
Craig Mautner | 5962b12 | 2012-10-05 14:45:52 -0700 | [diff] [blame] | 232 | /** |
John Spurlock | 322d771 | 2013-09-05 02:39:46 +0000 | [diff] [blame] | 233 | * Bit in {@link #flags} corresponding to an immersive activity |
Daniel Sandler | 613dde4 | 2010-06-21 13:46:39 -0400 | [diff] [blame] | 234 | * that wishes not to be interrupted by notifications. |
| 235 | * Applications that hide the system notification bar with |
| 236 | * {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN} |
| 237 | * may still be interrupted by high-priority notifications; for example, an |
| 238 | * incoming phone call may use |
Daniel Sandler | 8091ca5 | 2010-06-22 13:58:46 -0400 | [diff] [blame] | 239 | * {@link android.app.Notification#fullScreenIntent fullScreenIntent} |
Daniel Sandler | 613dde4 | 2010-06-21 13:46:39 -0400 | [diff] [blame] | 240 | * to present a full-screen in-call activity to the user, pausing the |
| 241 | * current activity as a side-effect. An activity with |
| 242 | * {@link #FLAG_IMMERSIVE} set, however, will not be interrupted; the |
| 243 | * notification may be shown in some other way (such as a small floating |
| 244 | * "toast" window). |
Christopher Tate | 73c2aee | 2012-03-15 16:27:14 -0700 | [diff] [blame] | 245 | * |
| 246 | * Note that this flag will always reflect the Activity's |
| 247 | * <code>android:immersive</code> manifest definition, even if the Activity's |
| 248 | * immersive state is changed at runtime via |
| 249 | * {@link android.app.Activity#setImmersive(boolean)}. |
| 250 | * |
| 251 | * @see android.app.Notification#FLAG_HIGH_PRIORITY |
| 252 | * @see android.app.Activity#setImmersive(boolean) |
Daniel Sandler | 613dde4 | 2010-06-21 13:46:39 -0400 | [diff] [blame] | 253 | */ |
Craig Mautner | 5962b12 | 2012-10-05 14:45:52 -0700 | [diff] [blame] | 254 | public static final int FLAG_IMMERSIVE = 0x0800; |
Romain Guy | 529b60a | 2010-08-03 18:05:47 -0700 | [diff] [blame] | 255 | /** |
Craig Mautner | 9d4e9bc | 2014-06-18 18:34:56 -0700 | [diff] [blame] | 256 | * Bit in {@link #flags}: If set, a task rooted at this activity will have its |
| 257 | * baseIntent replaced by the activity immediately above this. Each activity may further |
| 258 | * relinquish its identity to the activity above it using this flag. Set from the |
Dianne Hackborn | a4e102e | 2014-09-04 22:52:27 -0700 | [diff] [blame] | 259 | * {@link android.R.attr#relinquishTaskIdentity} attribute. |
Craig Mautner | 9d4e9bc | 2014-06-18 18:34:56 -0700 | [diff] [blame] | 260 | */ |
| 261 | public static final int FLAG_RELINQUISH_TASK_IDENTITY = 0x1000; |
| 262 | /** |
Craig Mautner | 2dac056 | 2014-05-06 09:06:44 -0700 | [diff] [blame] | 263 | * Bit in {@link #flags} indicating that tasks started with this activity are to be |
| 264 | * removed from the recent list of tasks when the last activity in the task is finished. |
Dianne Hackborn | a4e102e | 2014-09-04 22:52:27 -0700 | [diff] [blame] | 265 | * Corresponds to {@link android.R.attr#autoRemoveFromRecents} |
Craig Mautner | 2dac056 | 2014-05-06 09:06:44 -0700 | [diff] [blame] | 266 | */ |
| 267 | public static final int FLAG_AUTO_REMOVE_FROM_RECENTS = 0x2000; |
| 268 | /** |
Dianne Hackborn | a4e102e | 2014-09-04 22:52:27 -0700 | [diff] [blame] | 269 | * Bit in {@link #flags} indicating that this activity can start is creation/resume |
| 270 | * while the previous activity is still pausing. Corresponds to |
| 271 | * {@link android.R.attr#resumeWhilePausing} |
| 272 | */ |
| 273 | public static final int FLAG_RESUME_WHILE_PAUSING = 0x4000; |
| 274 | /** |
Dianne Hackborn | d4ac8d7 | 2012-09-27 23:20:10 -0700 | [diff] [blame] | 275 | * @hide Bit in {@link #flags}: If set, this component will only be seen |
| 276 | * by the primary user. Only works with broadcast receivers. Set from the |
Craig Mautner | ffd14a1 | 2014-04-23 21:38:50 -0700 | [diff] [blame] | 277 | * android.R.attr#primaryUserOnly attribute. |
Dianne Hackborn | d4ac8d7 | 2012-09-27 23:20:10 -0700 | [diff] [blame] | 278 | */ |
| 279 | public static final int FLAG_PRIMARY_USER_ONLY = 0x20000000; |
| 280 | /** |
Dianne Hackborn | 7d19e02 | 2012-08-07 19:12:33 -0700 | [diff] [blame] | 281 | * Bit in {@link #flags}: If set, a single instance of the receiver will |
| 282 | * run for all users on the device. Set from the |
| 283 | * {@link android.R.attr#singleUser} attribute. Note that this flag is |
Dianne Hackborn | d4ac8d7 | 2012-09-27 23:20:10 -0700 | [diff] [blame] | 284 | * only relevant for ActivityInfo structures that are describing receiver |
Dianne Hackborn | 7d19e02 | 2012-08-07 19:12:33 -0700 | [diff] [blame] | 285 | * components; it is not applied to activities. |
| 286 | */ |
| 287 | public static final int FLAG_SINGLE_USER = 0x40000000; |
| 288 | /** |
Craig Mautner | ffd14a1 | 2014-04-23 21:38:50 -0700 | [diff] [blame] | 289 | * @hide Bit in {@link #flags}: If set, this activity may be launched into an |
| 290 | * owned ActivityContainer such as that within an ActivityView. If not set and |
| 291 | * this activity is launched into such a container a SecurityExcception will be |
| 292 | * thrown. Set from the {@link android.R.attr#allowEmbedded} attribute. |
| 293 | */ |
| 294 | public static final int FLAG_ALLOW_EMBEDDED = 0x80000000; |
| 295 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 296 | * Options that have been set in the activity declaration in the |
Daniel Sandler | 613dde4 | 2010-06-21 13:46:39 -0400 | [diff] [blame] | 297 | * manifest. |
| 298 | * These include: |
| 299 | * {@link #FLAG_MULTIPROCESS}, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 300 | * {@link #FLAG_FINISH_ON_TASK_LAUNCH}, {@link #FLAG_CLEAR_TASK_ON_LAUNCH}, |
| 301 | * {@link #FLAG_ALWAYS_RETAIN_TASK_STATE}, |
| 302 | * {@link #FLAG_STATE_NOT_NEEDED}, {@link #FLAG_EXCLUDE_FROM_RECENTS}, |
Dianne Hackborn | ffa4248 | 2009-09-23 22:20:11 -0700 | [diff] [blame] | 303 | * {@link #FLAG_ALLOW_TASK_REPARENTING}, {@link #FLAG_NO_HISTORY}, |
Daniel Sandler | 613dde4 | 2010-06-21 13:46:39 -0400 | [diff] [blame] | 304 | * {@link #FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS}, |
Dianne Hackborn | 7d19e02 | 2012-08-07 19:12:33 -0700 | [diff] [blame] | 305 | * {@link #FLAG_HARDWARE_ACCELERATED}, {@link #FLAG_SINGLE_USER}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 306 | */ |
| 307 | public int flags; |
| 308 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 309 | /** @hide */ |
| 310 | @IntDef({ |
| 311 | SCREEN_ORIENTATION_UNSPECIFIED, |
| 312 | SCREEN_ORIENTATION_LANDSCAPE, |
| 313 | SCREEN_ORIENTATION_PORTRAIT, |
| 314 | SCREEN_ORIENTATION_USER, |
| 315 | SCREEN_ORIENTATION_BEHIND, |
| 316 | SCREEN_ORIENTATION_SENSOR, |
| 317 | SCREEN_ORIENTATION_NOSENSOR, |
| 318 | SCREEN_ORIENTATION_SENSOR_LANDSCAPE, |
| 319 | SCREEN_ORIENTATION_SENSOR_PORTRAIT, |
| 320 | SCREEN_ORIENTATION_REVERSE_LANDSCAPE, |
| 321 | SCREEN_ORIENTATION_REVERSE_PORTRAIT, |
| 322 | SCREEN_ORIENTATION_FULL_SENSOR, |
| 323 | SCREEN_ORIENTATION_USER_LANDSCAPE, |
| 324 | SCREEN_ORIENTATION_USER_PORTRAIT, |
| 325 | SCREEN_ORIENTATION_FULL_USER, |
| 326 | SCREEN_ORIENTATION_LOCKED |
| 327 | }) |
| 328 | @Retention(RetentionPolicy.SOURCE) |
| 329 | public @interface ScreenOrientation {} |
| 330 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 331 | /** |
| 332 | * Constant corresponding to <code>unspecified</code> in |
| 333 | * the {@link android.R.attr#screenOrientation} attribute. |
| 334 | */ |
| 335 | public static final int SCREEN_ORIENTATION_UNSPECIFIED = -1; |
| 336 | /** |
| 337 | * Constant corresponding to <code>landscape</code> in |
| 338 | * the {@link android.R.attr#screenOrientation} attribute. |
| 339 | */ |
| 340 | public static final int SCREEN_ORIENTATION_LANDSCAPE = 0; |
| 341 | /** |
| 342 | * Constant corresponding to <code>portrait</code> in |
| 343 | * the {@link android.R.attr#screenOrientation} attribute. |
| 344 | */ |
| 345 | public static final int SCREEN_ORIENTATION_PORTRAIT = 1; |
| 346 | /** |
| 347 | * Constant corresponding to <code>user</code> in |
| 348 | * the {@link android.R.attr#screenOrientation} attribute. |
| 349 | */ |
| 350 | public static final int SCREEN_ORIENTATION_USER = 2; |
| 351 | /** |
| 352 | * Constant corresponding to <code>behind</code> in |
| 353 | * the {@link android.R.attr#screenOrientation} attribute. |
| 354 | */ |
| 355 | public static final int SCREEN_ORIENTATION_BEHIND = 3; |
| 356 | /** |
| 357 | * Constant corresponding to <code>sensor</code> in |
| 358 | * the {@link android.R.attr#screenOrientation} attribute. |
| 359 | */ |
| 360 | public static final int SCREEN_ORIENTATION_SENSOR = 4; |
| 361 | |
| 362 | /** |
Dianne Hackborn | e5439f2 | 2010-10-02 16:53:50 -0700 | [diff] [blame] | 363 | * Constant corresponding to <code>nosensor</code> in |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 364 | * the {@link android.R.attr#screenOrientation} attribute. |
| 365 | */ |
| 366 | public static final int SCREEN_ORIENTATION_NOSENSOR = 5; |
Dianne Hackborn | e5439f2 | 2010-10-02 16:53:50 -0700 | [diff] [blame] | 367 | |
| 368 | /** |
| 369 | * Constant corresponding to <code>sensorLandscape</code> in |
| 370 | * the {@link android.R.attr#screenOrientation} attribute. |
| 371 | */ |
| 372 | public static final int SCREEN_ORIENTATION_SENSOR_LANDSCAPE = 6; |
| 373 | |
| 374 | /** |
| 375 | * Constant corresponding to <code>sensorPortrait</code> in |
| 376 | * the {@link android.R.attr#screenOrientation} attribute. |
| 377 | */ |
| 378 | public static final int SCREEN_ORIENTATION_SENSOR_PORTRAIT = 7; |
| 379 | |
| 380 | /** |
| 381 | * Constant corresponding to <code>reverseLandscape</code> in |
| 382 | * the {@link android.R.attr#screenOrientation} attribute. |
| 383 | */ |
| 384 | public static final int SCREEN_ORIENTATION_REVERSE_LANDSCAPE = 8; |
| 385 | |
| 386 | /** |
| 387 | * Constant corresponding to <code>reversePortrait</code> in |
| 388 | * the {@link android.R.attr#screenOrientation} attribute. |
| 389 | */ |
| 390 | public static final int SCREEN_ORIENTATION_REVERSE_PORTRAIT = 9; |
| 391 | |
| 392 | /** |
| 393 | * Constant corresponding to <code>fullSensor</code> in |
| 394 | * the {@link android.R.attr#screenOrientation} attribute. |
| 395 | */ |
| 396 | public static final int SCREEN_ORIENTATION_FULL_SENSOR = 10; |
| 397 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 398 | /** |
Dianne Hackborn | b9ec1ac | 2013-04-10 17:34:25 -0700 | [diff] [blame] | 399 | * Constant corresponding to <code>userLandscape</code> in |
| 400 | * the {@link android.R.attr#screenOrientation} attribute. |
| 401 | */ |
| 402 | public static final int SCREEN_ORIENTATION_USER_LANDSCAPE = 11; |
| 403 | |
| 404 | /** |
| 405 | * Constant corresponding to <code>userPortrait</code> in |
| 406 | * the {@link android.R.attr#screenOrientation} attribute. |
| 407 | */ |
| 408 | public static final int SCREEN_ORIENTATION_USER_PORTRAIT = 12; |
| 409 | |
| 410 | /** |
| 411 | * Constant corresponding to <code>fullUser</code> in |
| 412 | * the {@link android.R.attr#screenOrientation} attribute. |
| 413 | */ |
| 414 | public static final int SCREEN_ORIENTATION_FULL_USER = 13; |
| 415 | |
| 416 | /** |
| 417 | * Constant corresponding to <code>locked</code> in |
| 418 | * the {@link android.R.attr#screenOrientation} attribute. |
| 419 | */ |
| 420 | public static final int SCREEN_ORIENTATION_LOCKED = 14; |
| 421 | |
| 422 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 423 | * The preferred screen orientation this activity would like to run in. |
| 424 | * From the {@link android.R.attr#screenOrientation} attribute, one of |
| 425 | * {@link #SCREEN_ORIENTATION_UNSPECIFIED}, |
| 426 | * {@link #SCREEN_ORIENTATION_LANDSCAPE}, |
| 427 | * {@link #SCREEN_ORIENTATION_PORTRAIT}, |
| 428 | * {@link #SCREEN_ORIENTATION_USER}, |
| 429 | * {@link #SCREEN_ORIENTATION_BEHIND}, |
| 430 | * {@link #SCREEN_ORIENTATION_SENSOR}, |
Dianne Hackborn | e5439f2 | 2010-10-02 16:53:50 -0700 | [diff] [blame] | 431 | * {@link #SCREEN_ORIENTATION_NOSENSOR}, |
| 432 | * {@link #SCREEN_ORIENTATION_SENSOR_LANDSCAPE}, |
| 433 | * {@link #SCREEN_ORIENTATION_SENSOR_PORTRAIT}, |
| 434 | * {@link #SCREEN_ORIENTATION_REVERSE_LANDSCAPE}, |
| 435 | * {@link #SCREEN_ORIENTATION_REVERSE_PORTRAIT}, |
Dianne Hackborn | b9ec1ac | 2013-04-10 17:34:25 -0700 | [diff] [blame] | 436 | * {@link #SCREEN_ORIENTATION_FULL_SENSOR}, |
| 437 | * {@link #SCREEN_ORIENTATION_USER_LANDSCAPE}, |
| 438 | * {@link #SCREEN_ORIENTATION_USER_PORTRAIT}, |
| 439 | * {@link #SCREEN_ORIENTATION_FULL_USER}, |
| 440 | * {@link #SCREEN_ORIENTATION_LOCKED}, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 441 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 442 | @ScreenOrientation |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 443 | public int screenOrientation = SCREEN_ORIENTATION_UNSPECIFIED; |
| 444 | |
| 445 | /** |
| 446 | * Bit in {@link #configChanges} that indicates that the activity |
| 447 | * can itself handle changes to the IMSI MCC. Set from the |
| 448 | * {@link android.R.attr#configChanges} attribute. |
| 449 | */ |
| 450 | public static final int CONFIG_MCC = 0x0001; |
| 451 | /** |
| 452 | * Bit in {@link #configChanges} that indicates that the activity |
| 453 | * can itself handle changes to the IMSI MNC. Set from the |
| 454 | * {@link android.R.attr#configChanges} attribute. |
| 455 | */ |
| 456 | public static final int CONFIG_MNC = 0x0002; |
| 457 | /** |
| 458 | * Bit in {@link #configChanges} that indicates that the activity |
| 459 | * can itself handle changes to the locale. Set from the |
| 460 | * {@link android.R.attr#configChanges} attribute. |
| 461 | */ |
| 462 | public static final int CONFIG_LOCALE = 0x0004; |
| 463 | /** |
| 464 | * Bit in {@link #configChanges} that indicates that the activity |
| 465 | * can itself handle changes to the touchscreen type. Set from the |
| 466 | * {@link android.R.attr#configChanges} attribute. |
| 467 | */ |
| 468 | public static final int CONFIG_TOUCHSCREEN = 0x0008; |
| 469 | /** |
| 470 | * Bit in {@link #configChanges} that indicates that the activity |
| 471 | * can itself handle changes to the keyboard type. Set from the |
| 472 | * {@link android.R.attr#configChanges} attribute. |
| 473 | */ |
| 474 | public static final int CONFIG_KEYBOARD = 0x0010; |
| 475 | /** |
| 476 | * Bit in {@link #configChanges} that indicates that the activity |
Dianne Hackborn | 93e462b | 2009-09-15 22:50:40 -0700 | [diff] [blame] | 477 | * can itself handle changes to the keyboard or navigation being hidden/exposed. |
| 478 | * Note that inspite of the name, this applies to the changes to any |
| 479 | * hidden states: keyboard or navigation. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 480 | * Set from the {@link android.R.attr#configChanges} attribute. |
| 481 | */ |
| 482 | public static final int CONFIG_KEYBOARD_HIDDEN = 0x0020; |
| 483 | /** |
| 484 | * Bit in {@link #configChanges} that indicates that the activity |
| 485 | * can itself handle changes to the navigation type. Set from the |
| 486 | * {@link android.R.attr#configChanges} attribute. |
| 487 | */ |
| 488 | public static final int CONFIG_NAVIGATION = 0x0040; |
| 489 | /** |
| 490 | * Bit in {@link #configChanges} that indicates that the activity |
| 491 | * can itself handle changes to the screen orientation. Set from the |
| 492 | * {@link android.R.attr#configChanges} attribute. |
| 493 | */ |
| 494 | public static final int CONFIG_ORIENTATION = 0x0080; |
| 495 | /** |
| 496 | * Bit in {@link #configChanges} that indicates that the activity |
Dianne Hackborn | 723738c | 2009-06-25 19:48:04 -0700 | [diff] [blame] | 497 | * can itself handle changes to the screen layout. Set from the |
| 498 | * {@link android.R.attr#configChanges} attribute. |
| 499 | */ |
| 500 | public static final int CONFIG_SCREEN_LAYOUT = 0x0100; |
| 501 | /** |
| 502 | * Bit in {@link #configChanges} that indicates that the activity |
Tobias Haamel | 27b28b3 | 2010-02-09 23:09:17 +0100 | [diff] [blame] | 503 | * can itself handle the ui mode. Set from the |
| 504 | * {@link android.R.attr#configChanges} attribute. |
Tobias Haamel | 27b28b3 | 2010-02-09 23:09:17 +0100 | [diff] [blame] | 505 | */ |
| 506 | public static final int CONFIG_UI_MODE = 0x0200; |
| 507 | /** |
| 508 | * Bit in {@link #configChanges} that indicates that the activity |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 509 | * can itself handle the screen size. Set from the |
Dianne Hackborn | e667635 | 2011-06-01 16:51:20 -0700 | [diff] [blame] | 510 | * {@link android.R.attr#configChanges} attribute. This will be |
| 511 | * set by default for applications that target an earlier version |
| 512 | * than {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}... |
| 513 | * <b>however</b>, you will not see the bit set here becomes some |
| 514 | * applications incorrectly compare {@link #configChanges} against |
| 515 | * an absolute value rather than correctly masking out the bits |
| 516 | * they are interested in. Please don't do that, thanks. |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 517 | */ |
| 518 | public static final int CONFIG_SCREEN_SIZE = 0x0400; |
| 519 | /** |
| 520 | * Bit in {@link #configChanges} that indicates that the activity |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 521 | * can itself handle the smallest screen size. Set from the |
Dianne Hackborn | e667635 | 2011-06-01 16:51:20 -0700 | [diff] [blame] | 522 | * {@link android.R.attr#configChanges} attribute. This will be |
| 523 | * set by default for applications that target an earlier version |
| 524 | * than {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}... |
| 525 | * <b>however</b>, you will not see the bit set here becomes some |
| 526 | * applications incorrectly compare {@link #configChanges} against |
| 527 | * an absolute value rather than correctly masking out the bits |
| 528 | * they are interested in. Please don't do that, thanks. |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 529 | */ |
| 530 | public static final int CONFIG_SMALLEST_SCREEN_SIZE = 0x0800; |
| 531 | /** |
| 532 | * Bit in {@link #configChanges} that indicates that the activity |
Dianne Hackborn | 908aecc | 2012-07-31 16:37:34 -0700 | [diff] [blame] | 533 | * can itself handle density changes. Set from the |
| 534 | * {@link android.R.attr#configChanges} attribute. |
| 535 | */ |
| 536 | public static final int CONFIG_DENSITY = 0x1000; |
| 537 | /** |
| 538 | * Bit in {@link #configChanges} that indicates that the activity |
Fabrice Di Meglio | 5f79799 | 2012-06-15 20:16:41 -0700 | [diff] [blame] | 539 | * can itself handle the change to layout direction. Set from the |
| 540 | * {@link android.R.attr#configChanges} attribute. |
| 541 | */ |
| 542 | public static final int CONFIG_LAYOUT_DIRECTION = 0x2000; |
| 543 | /** |
| 544 | * Bit in {@link #configChanges} that indicates that the activity |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 545 | * can itself handle changes to the font scaling factor. Set from the |
| 546 | * {@link android.R.attr#configChanges} attribute. This is |
Fabrice Di Meglio | dc25d25 | 2013-04-09 18:04:29 -0700 | [diff] [blame] | 547 | * not a core resource configuration, but a higher-level value, so its |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 548 | * constant starts at the high bits. |
| 549 | */ |
| 550 | public static final int CONFIG_FONT_SCALE = 0x40000000; |
| 551 | |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 552 | /** @hide |
| 553 | * Unfortunately the constants for config changes in native code are |
| 554 | * different from ActivityInfo. :( Here are the values we should use for the |
| 555 | * native side given the bit we have assigned in ActivityInfo. |
| 556 | */ |
| 557 | public static int[] CONFIG_NATIVE_BITS = new int[] { |
Dianne Hackborn | 1d0b177 | 2013-09-06 14:02:54 -0700 | [diff] [blame] | 558 | Configuration.NATIVE_CONFIG_MNC, // MNC |
| 559 | Configuration.NATIVE_CONFIG_MCC, // MCC |
| 560 | Configuration.NATIVE_CONFIG_LOCALE, // LOCALE |
| 561 | Configuration.NATIVE_CONFIG_TOUCHSCREEN, // TOUCH SCREEN |
| 562 | Configuration.NATIVE_CONFIG_KEYBOARD, // KEYBOARD |
| 563 | Configuration.NATIVE_CONFIG_KEYBOARD_HIDDEN, // KEYBOARD HIDDEN |
| 564 | Configuration.NATIVE_CONFIG_NAVIGATION, // NAVIGATION |
| 565 | Configuration.NATIVE_CONFIG_ORIENTATION, // ORIENTATION |
| 566 | Configuration.NATIVE_CONFIG_SCREEN_LAYOUT, // SCREEN LAYOUT |
| 567 | Configuration.NATIVE_CONFIG_UI_MODE, // UI MODE |
| 568 | Configuration.NATIVE_CONFIG_SCREEN_SIZE, // SCREEN SIZE |
| 569 | Configuration.NATIVE_CONFIG_SMALLEST_SCREEN_SIZE, // SMALLEST SCREEN SIZE |
| 570 | Configuration.NATIVE_CONFIG_DENSITY, // DENSITY |
| 571 | Configuration.NATIVE_CONFIG_LAYOUTDIR, // LAYOUT DIRECTION |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 572 | }; |
| 573 | /** @hide |
| 574 | * Convert Java change bits to native. |
| 575 | */ |
| 576 | public static int activityInfoConfigToNative(int input) { |
| 577 | int output = 0; |
| 578 | for (int i=0; i<CONFIG_NATIVE_BITS.length; i++) { |
| 579 | if ((input&(1<<i)) != 0) { |
| 580 | output |= CONFIG_NATIVE_BITS[i]; |
| 581 | } |
| 582 | } |
| 583 | return output; |
| 584 | } |
| 585 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 586 | /** |
Dianne Hackborn | e667635 | 2011-06-01 16:51:20 -0700 | [diff] [blame] | 587 | * @hide |
| 588 | * Unfortunately some developers (OpenFeint I am looking at you) have |
| 589 | * compared the configChanges bit field against absolute values, so if we |
| 590 | * introduce a new bit they break. To deal with that, we will make sure |
| 591 | * the public field will not have a value that breaks them, and let the |
| 592 | * framework call here to get the real value. |
| 593 | */ |
| 594 | public int getRealConfigChanged() { |
| 595 | return applicationInfo.targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB_MR2 |
| 596 | ? (configChanges | ActivityInfo.CONFIG_SCREEN_SIZE |
| 597 | | ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE) |
| 598 | : configChanges; |
| 599 | } |
| 600 | |
| 601 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 602 | * Bit mask of kinds of configuration changes that this activity |
| 603 | * can handle itself (without being restarted by the system). |
| 604 | * Contains any combination of {@link #CONFIG_FONT_SCALE}, |
| 605 | * {@link #CONFIG_MCC}, {@link #CONFIG_MNC}, |
| 606 | * {@link #CONFIG_LOCALE}, {@link #CONFIG_TOUCHSCREEN}, |
Dianne Hackborn | 723738c | 2009-06-25 19:48:04 -0700 | [diff] [blame] | 607 | * {@link #CONFIG_KEYBOARD}, {@link #CONFIG_NAVIGATION}, |
Fabrice Di Meglio | 5f79799 | 2012-06-15 20:16:41 -0700 | [diff] [blame] | 608 | * {@link #CONFIG_ORIENTATION}, {@link #CONFIG_SCREEN_LAYOUT} and |
| 609 | * {@link #CONFIG_LAYOUT_DIRECTION}. Set from the {@link android.R.attr#configChanges} |
| 610 | * attribute. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 611 | */ |
| 612 | public int configChanges; |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 613 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 614 | /** |
| 615 | * The desired soft input mode for this activity's main window. |
| 616 | * Set from the {@link android.R.attr#windowSoftInputMode} attribute |
| 617 | * in the activity's manifest. May be any of the same values allowed |
| 618 | * for {@link android.view.WindowManager.LayoutParams#softInputMode |
| 619 | * WindowManager.LayoutParams.softInputMode}. If 0 (unspecified), |
| 620 | * the mode from the theme will be used. |
| 621 | */ |
| 622 | public int softInputMode; |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 623 | |
| 624 | /** |
| 625 | * The desired extra UI options for this activity and its main window. |
| 626 | * Set from the {@link android.R.attr#uiOptions} attribute in the |
| 627 | * activity's manifest. |
| 628 | */ |
| 629 | public int uiOptions = 0; |
| 630 | |
| 631 | /** |
Scott Main | e797ed6 | 2011-09-22 16:17:45 -0700 | [diff] [blame] | 632 | * Flag for use with {@link #uiOptions}. |
| 633 | * Indicates that the action bar should put all action items in a separate bar when |
| 634 | * the screen is narrow. |
| 635 | * <p>This value corresponds to "splitActionBarWhenNarrow" for the {@link #uiOptions} XML |
| 636 | * attribute. |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 637 | */ |
| 638 | public static final int UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW = 1; |
| 639 | |
Adam Powell | dd8fab2 | 2012-03-22 17:47:27 -0700 | [diff] [blame] | 640 | /** |
| 641 | * If defined, the activity named here is the logical parent of this activity. |
| 642 | */ |
| 643 | public String parentActivityName; |
| 644 | |
Wale Ogunwale | 9d3de4c | 2015-02-01 16:49:44 -0800 | [diff] [blame] | 645 | /** |
| 646 | * Value indicating if the activity is resizeable to any dimension. |
| 647 | * See {@link android.R.attr#resizeableActivity}. |
Wale Ogunwale | 4aab1bb | 2015-02-03 09:29:00 -0800 | [diff] [blame] | 648 | * @hide |
Wale Ogunwale | 9d3de4c | 2015-02-01 16:49:44 -0800 | [diff] [blame] | 649 | */ |
| 650 | public boolean resizeable; |
| 651 | |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 652 | /** @hide */ |
| 653 | public static final int LOCK_TASK_LAUNCH_MODE_DEFAULT = 0; |
| 654 | /** @hide */ |
| 655 | public static final int LOCK_TASK_LAUNCH_MODE_NEVER = 1; |
| 656 | /** @hide */ |
| 657 | public static final int LOCK_TASK_LAUNCH_MODE_ALWAYS = 2; |
| 658 | /** @hide */ |
| 659 | public static final int LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED = 3; |
| 660 | |
| 661 | /** @hide */ |
| 662 | public static final String lockTaskLaunchModeToString(int lockTaskLaunchMode) { |
| 663 | switch (lockTaskLaunchMode) { |
| 664 | case LOCK_TASK_LAUNCH_MODE_DEFAULT: |
| 665 | return "LOCK_TASK_LAUNCH_MODE_DEFAULT"; |
| 666 | case LOCK_TASK_LAUNCH_MODE_NEVER: |
| 667 | return "LOCK_TASK_LAUNCH_MODE_NEVER"; |
| 668 | case LOCK_TASK_LAUNCH_MODE_ALWAYS: |
| 669 | return "LOCK_TASK_LAUNCH_MODE_ALWAYS"; |
| 670 | case LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED: |
| 671 | return "LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED"; |
| 672 | default: |
| 673 | return "unknown=" + lockTaskLaunchMode; |
| 674 | } |
| 675 | } |
| 676 | /** |
| 677 | * Value indicating if the activity is to be locked at startup. Takes on the values from |
| 678 | * {@link android.R.attr#lockTaskMode}. |
| 679 | * @hide |
| 680 | */ |
| 681 | public int lockTaskLaunchMode; |
| 682 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 683 | public ActivityInfo() { |
| 684 | } |
| 685 | |
| 686 | public ActivityInfo(ActivityInfo orig) { |
| 687 | super(orig); |
| 688 | theme = orig.theme; |
| 689 | launchMode = orig.launchMode; |
| 690 | permission = orig.permission; |
| 691 | taskAffinity = orig.taskAffinity; |
| 692 | targetActivity = orig.targetActivity; |
| 693 | flags = orig.flags; |
| 694 | screenOrientation = orig.screenOrientation; |
| 695 | configChanges = orig.configChanges; |
| 696 | softInputMode = orig.softInputMode; |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 697 | uiOptions = orig.uiOptions; |
Adam Powell | dd8fab2 | 2012-03-22 17:47:27 -0700 | [diff] [blame] | 698 | parentActivityName = orig.parentActivityName; |
Craig Mautner | 8307ea7 | 2014-09-11 15:03:53 -0700 | [diff] [blame] | 699 | maxRecents = orig.maxRecents; |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 700 | resizeable = orig.resizeable; |
| 701 | lockTaskLaunchMode = orig.lockTaskLaunchMode; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 702 | } |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 703 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 704 | /** |
| 705 | * Return the theme resource identifier to use for this activity. If |
| 706 | * the activity defines a theme, that is used; else, the application |
| 707 | * theme is used. |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 708 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 709 | * @return The theme associated with this activity. |
| 710 | */ |
| 711 | public final int getThemeResource() { |
| 712 | return theme != 0 ? theme : applicationInfo.theme; |
| 713 | } |
| 714 | |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 715 | private String persistableModeToString() { |
| 716 | switch(persistableMode) { |
| 717 | case PERSIST_ROOT_ONLY: return "PERSIST_ROOT_ONLY"; |
Craig Mautner | 7f72f53 | 2014-07-21 10:07:12 -0700 | [diff] [blame] | 718 | case PERSIST_NEVER: return "PERSIST_NEVER"; |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 719 | case PERSIST_ACROSS_REBOOTS: return "PERSIST_ACROSS_REBOOTS"; |
| 720 | default: return "UNKNOWN=" + persistableMode; |
| 721 | } |
| 722 | } |
| 723 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 724 | public void dump(Printer pw, String prefix) { |
| 725 | super.dumpFront(pw, prefix); |
Dianne Hackborn | 12527f9 | 2009-11-11 17:39:50 -0800 | [diff] [blame] | 726 | if (permission != null) { |
| 727 | pw.println(prefix + "permission=" + permission); |
| 728 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 729 | pw.println(prefix + "taskAffinity=" + taskAffinity |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 730 | + " targetActivity=" + targetActivity |
| 731 | + " persistableMode=" + persistableModeToString()); |
Dianne Hackborn | 12527f9 | 2009-11-11 17:39:50 -0800 | [diff] [blame] | 732 | if (launchMode != 0 || flags != 0 || theme != 0) { |
| 733 | pw.println(prefix + "launchMode=" + launchMode |
| 734 | + " flags=0x" + Integer.toHexString(flags) |
| 735 | + " theme=0x" + Integer.toHexString(theme)); |
| 736 | } |
| 737 | if (screenOrientation != SCREEN_ORIENTATION_UNSPECIFIED |
| 738 | || configChanges != 0 || softInputMode != 0) { |
| 739 | pw.println(prefix + "screenOrientation=" + screenOrientation |
| 740 | + " configChanges=0x" + Integer.toHexString(configChanges) |
| 741 | + " softInputMode=0x" + Integer.toHexString(softInputMode)); |
| 742 | } |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 743 | if (uiOptions != 0) { |
| 744 | pw.println(prefix + " uiOptions=0x" + Integer.toHexString(uiOptions)); |
| 745 | } |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 746 | pw.println(prefix + "resizeable=" + resizeable + " lockTaskLaunchMode=" |
| 747 | + lockTaskLaunchModeToString(lockTaskLaunchMode)); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 748 | super.dumpBack(pw, prefix); |
| 749 | } |
| 750 | |
| 751 | public String toString() { |
| 752 | return "ActivityInfo{" |
| 753 | + Integer.toHexString(System.identityHashCode(this)) |
| 754 | + " " + name + "}"; |
| 755 | } |
| 756 | |
| 757 | public int describeContents() { |
| 758 | return 0; |
| 759 | } |
| 760 | |
| 761 | public void writeToParcel(Parcel dest, int parcelableFlags) { |
| 762 | super.writeToParcel(dest, parcelableFlags); |
| 763 | dest.writeInt(theme); |
| 764 | dest.writeInt(launchMode); |
| 765 | dest.writeString(permission); |
| 766 | dest.writeString(taskAffinity); |
| 767 | dest.writeString(targetActivity); |
| 768 | dest.writeInt(flags); |
| 769 | dest.writeInt(screenOrientation); |
| 770 | dest.writeInt(configChanges); |
| 771 | dest.writeInt(softInputMode); |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 772 | dest.writeInt(uiOptions); |
Adam Powell | dd8fab2 | 2012-03-22 17:47:27 -0700 | [diff] [blame] | 773 | dest.writeString(parentActivityName); |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 774 | dest.writeInt(persistableMode); |
Craig Mautner | 8307ea7 | 2014-09-11 15:03:53 -0700 | [diff] [blame] | 775 | dest.writeInt(maxRecents); |
Wale Ogunwale | 9d3de4c | 2015-02-01 16:49:44 -0800 | [diff] [blame] | 776 | dest.writeInt(resizeable ? 1 : 0); |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 777 | dest.writeInt(lockTaskLaunchMode); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 778 | } |
| 779 | |
| 780 | public static final Parcelable.Creator<ActivityInfo> CREATOR |
| 781 | = new Parcelable.Creator<ActivityInfo>() { |
| 782 | public ActivityInfo createFromParcel(Parcel source) { |
| 783 | return new ActivityInfo(source); |
| 784 | } |
| 785 | public ActivityInfo[] newArray(int size) { |
| 786 | return new ActivityInfo[size]; |
| 787 | } |
| 788 | }; |
| 789 | |
| 790 | private ActivityInfo(Parcel source) { |
| 791 | super(source); |
| 792 | theme = source.readInt(); |
| 793 | launchMode = source.readInt(); |
| 794 | permission = source.readString(); |
| 795 | taskAffinity = source.readString(); |
| 796 | targetActivity = source.readString(); |
| 797 | flags = source.readInt(); |
| 798 | screenOrientation = source.readInt(); |
| 799 | configChanges = source.readInt(); |
| 800 | softInputMode = source.readInt(); |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 801 | uiOptions = source.readInt(); |
Adam Powell | dd8fab2 | 2012-03-22 17:47:27 -0700 | [diff] [blame] | 802 | parentActivityName = source.readString(); |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 803 | persistableMode = source.readInt(); |
Craig Mautner | 8307ea7 | 2014-09-11 15:03:53 -0700 | [diff] [blame] | 804 | maxRecents = source.readInt(); |
Wale Ogunwale | 9d3de4c | 2015-02-01 16:49:44 -0800 | [diff] [blame] | 805 | resizeable = (source.readInt() == 1); |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 806 | lockTaskLaunchMode = source.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 807 | } |
| 808 | } |