blob: 415c2428405f6e9cb3c79750d5327edc1e1197a9 [file] [log] [blame]
Kenny Root15a4d2f2010-03-11 18:20:12 -08001/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080017package android.content.pm;
18
Tor Norbyed9273d62013-05-30 15:59:53 -070019import android.annotation.IntDef;
Steven Timotius4346f0a2017-09-12 11:07:21 -070020import android.annotation.TestApi;
Mathew Inwood5c0d3542018-08-14 13:54:31 +010021import android.annotation.UnsupportedAppUsage;
Aurimas Liutikas7f695332018-05-31 21:07:32 -070022import android.content.ComponentName;
Todd Kennedyc05f5d12017-04-25 11:11:40 -070023import android.content.Intent;
Dianne Hackborn1d0b1772013-09-06 14:02:54 -070024import android.content.res.Configuration;
Alan Viveretteac85f902016-03-11 15:15:51 -050025import android.content.res.Configuration.NativeConfig;
Bryce Lee39791592017-04-26 09:29:12 -070026import android.content.res.TypedArray;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027import android.os.Parcel;
28import android.os.Parcelable;
29import android.util.Printer;
30
Tor Norbyed9273d62013-05-30 15:59:53 -070031import java.lang.annotation.Retention;
32import java.lang.annotation.RetentionPolicy;
33
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034/**
35 * Information you can retrieve about a particular application
36 * activity or receiver. This corresponds to information collected
37 * from the AndroidManifest.xml's <activity> and
38 * <receiver> tags.
39 */
Michael Wright19859762017-09-18 20:57:58 +010040public class ActivityInfo extends ComponentInfo implements Parcelable {
Robert Carr3e2e0112015-09-15 12:30:42 -070041
42 // NOTE: When adding new data members be sure to update the copy-constructor, Parcel
43 // constructor, and writeToParcel.
44
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045 /**
46 * A style resource identifier (in the package's resources) of this
47 * activity's theme. From the "theme" attribute or, if not set, 0.
48 */
49 public int theme;
Robert Carr3e2e0112015-09-15 12:30:42 -070050
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051 /**
52 * Constant corresponding to <code>standard</code> in
53 * the {@link android.R.attr#launchMode} attribute.
54 */
55 public static final int LAUNCH_MULTIPLE = 0;
56 /**
57 * Constant corresponding to <code>singleTop</code> in
58 * the {@link android.R.attr#launchMode} attribute.
59 */
60 public static final int LAUNCH_SINGLE_TOP = 1;
61 /**
62 * Constant corresponding to <code>singleTask</code> in
63 * the {@link android.R.attr#launchMode} attribute.
64 */
65 public static final int LAUNCH_SINGLE_TASK = 2;
66 /**
67 * Constant corresponding to <code>singleInstance</code> in
68 * the {@link android.R.attr#launchMode} attribute.
69 */
70 public static final int LAUNCH_SINGLE_INSTANCE = 3;
71 /**
72 * The launch mode style requested by the activity. From the
73 * {@link android.R.attr#launchMode} attribute, one of
74 * {@link #LAUNCH_MULTIPLE},
Filip Gruszczynskid2f1d942015-10-14 15:10:12 -070075 * {@link #LAUNCH_SINGLE_TOP}, {@link #LAUNCH_SINGLE_TASK}, or
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080076 * {@link #LAUNCH_SINGLE_INSTANCE}.
77 */
78 public int launchMode;
Craig Mautner2dac0562014-05-06 09:06:44 -070079
80 /**
81 * Constant corresponding to <code>none</code> in
82 * the {@link android.R.attr#documentLaunchMode} attribute.
83 */
84 public static final int DOCUMENT_LAUNCH_NONE = 0;
85 /**
86 * Constant corresponding to <code>intoExisting</code> in
87 * the {@link android.R.attr#documentLaunchMode} attribute.
88 */
89 public static final int DOCUMENT_LAUNCH_INTO_EXISTING = 1;
90 /**
91 * Constant corresponding to <code>always</code> in
92 * the {@link android.R.attr#documentLaunchMode} attribute.
93 */
94 public static final int DOCUMENT_LAUNCH_ALWAYS = 2;
95 /**
Craig Mautnerf357c0c2014-06-09 09:23:27 -070096 * Constant corresponding to <code>never</code> in
97 * the {@link android.R.attr#documentLaunchMode} attribute.
98 */
99 public static final int DOCUMENT_LAUNCH_NEVER = 3;
100 /**
Craig Mautner2dac0562014-05-06 09:06:44 -0700101 * The document launch mode style requested by the activity. From the
102 * {@link android.R.attr#documentLaunchMode} attribute, one of
103 * {@link #DOCUMENT_LAUNCH_NONE}, {@link #DOCUMENT_LAUNCH_INTO_EXISTING},
104 * {@link #DOCUMENT_LAUNCH_ALWAYS}.
105 *
106 * <p>Modes DOCUMENT_LAUNCH_ALWAYS
107 * and DOCUMENT_LAUNCH_INTO_EXISTING are equivalent to {@link
108 * android.content.Intent#FLAG_ACTIVITY_NEW_DOCUMENT
109 * Intent.FLAG_ACTIVITY_NEW_DOCUMENT} with and without {@link
110 * android.content.Intent#FLAG_ACTIVITY_MULTIPLE_TASK
111 * Intent.FLAG_ACTIVITY_MULTIPLE_TASK} respectively.
112 */
113 public int documentLaunchMode;
114
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800115 /**
Craig Mautner43e52ed2014-06-16 17:18:52 -0700116 * Constant corresponding to <code>persistRootOnly</code> in
117 * the {@link android.R.attr#persistableMode} attribute.
118 */
119 public static final int PERSIST_ROOT_ONLY = 0;
120 /**
121 * Constant corresponding to <code>doNotPersist</code> in
122 * the {@link android.R.attr#persistableMode} attribute.
123 */
Craig Mautner7f72f532014-07-21 10:07:12 -0700124 public static final int PERSIST_NEVER = 1;
Craig Mautner43e52ed2014-06-16 17:18:52 -0700125 /**
126 * Constant corresponding to <code>persistAcrossReboots</code> in
127 * the {@link android.R.attr#persistableMode} attribute.
128 */
129 public static final int PERSIST_ACROSS_REBOOTS = 2;
130 /**
131 * Value indicating how this activity is to be persisted across
132 * reboots for restoring in the Recents list.
133 * {@link android.R.attr#persistableMode}
134 */
135 public int persistableMode;
136
137 /**
Craig Mautnerffcfcaa2014-06-05 09:54:38 -0700138 * The maximum number of tasks rooted at this activity that can be in the recent task list.
139 * Refer to {@link android.R.attr#maxRecents}.
140 */
141 public int maxRecents;
142
143 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144 * Optional name of a permission required to be able to access this
145 * Activity. From the "permission" attribute.
146 */
147 public String permission;
Filip Gruszczynskid2f1d942015-10-14 15:10:12 -0700148
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800149 /**
150 * The affinity this activity has for another task in the system. The
151 * string here is the name of the task, often the package name of the
152 * overall package. If null, the activity has no affinity. Set from the
153 * {@link android.R.attr#taskAffinity} attribute.
154 */
155 public String taskAffinity;
Filip Gruszczynskid2f1d942015-10-14 15:10:12 -0700156
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800157 /**
158 * If this is an activity alias, this is the real activity class to run
159 * for it. Otherwise, this is null.
160 */
161 public String targetActivity;
Filip Gruszczynskid2f1d942015-10-14 15:10:12 -0700162
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800163 /**
Todd Kennedy50d946c12017-03-17 13:55:38 -0700164 * Token used to string together multiple events within a single launch action.
165 * @hide
166 */
167 public String launchToken;
168
169 /**
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800170 * Activity can not be resized and always occupies the fullscreen area with all windows fully
171 * visible.
172 * @hide
173 */
174 public static final int RESIZE_MODE_UNRESIZEABLE = 0;
175 /**
Wale Ogunwale72a73e32016-10-13 12:16:39 -0700176 * Activity didn't explicitly request to be resizeable, but we are making it resizeable because
Wale Ogunwaledf241e92016-10-13 15:14:21 -0700177 * of the SDK version it targets. Only affects apps with target SDK >= N where the app is
178 * implied to be resizeable if it doesn't explicitly set the attribute to any value.
Wale Ogunwale72a73e32016-10-13 12:16:39 -0700179 * @hide
180 */
181 public static final int RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION = 1;
182 /**
183 * Activity explicitly requested to be resizeable.
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800184 * @hide
185 */
Steven Timotius4346f0a2017-09-12 11:07:21 -0700186 @TestApi
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800187 public static final int RESIZE_MODE_RESIZEABLE = 2;
188 /**
Winson Chungd3395382016-12-13 11:49:09 -0800189 * Activity is resizeable and supported picture-in-picture mode. This flag is now deprecated
190 * since activities do not need to be resizeable to support picture-in-picture.
191 * See {@link #FLAG_SUPPORTS_PICTURE_IN_PICTURE}.
192 *
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800193 * @hide
Winson Chungd3395382016-12-13 11:49:09 -0800194 * @deprecated
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800195 */
Winson Chungd3395382016-12-13 11:49:09 -0800196 public static final int RESIZE_MODE_RESIZEABLE_AND_PIPABLE_DEPRECATED = 3;
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800197 /**
skuhne@google.com322347b2016-12-02 12:54:03 -0800198 * Activity does not support resizing, but we are forcing it to be resizeable. Only affects
Wale Ogunwaledf241e92016-10-13 15:14:21 -0700199 * certain pre-N apps where we force them to be resizeable.
Wale Ogunwaled829d362016-02-10 19:24:49 -0800200 * @hide
201 */
202 public static final int RESIZE_MODE_FORCE_RESIZEABLE = 4;
203 /**
skuhne@google.com322347b2016-12-02 12:54:03 -0800204 * Activity does not support resizing, but we are forcing it to be resizeable as long
205 * as the size remains landscape.
206 * @hide
207 */
208 public static final int RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY = 5;
209 /**
210 * Activity does not support resizing, but we are forcing it to be resizeable as long
211 * as the size remains portrait.
212 * @hide
213 */
214 public static final int RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY = 6;
215 /**
216 * Activity does not support resizing, but we are forcing it to be resizeable as long
217 * as the bounds remain in the same orientation as they are.
218 * @hide
219 */
220 public static final int RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION = 7;
221 /**
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800222 * Value indicating if the resizing mode the activity supports.
223 * See {@link android.R.attr#resizeableActivity}.
224 * @hide
225 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +0100226 @UnsupportedAppUsage
Wale Ogunwale8f6c9252016-04-29 16:46:47 -0700227 public int resizeMode = RESIZE_MODE_RESIZEABLE;
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800228
229 /**
Wale Ogunwale55ddf8f2017-03-20 08:56:38 -0700230 * Value indicating the maximum aspect ratio the activity supports.
231 * <p>
232 * 0 means unset.
233 * @See {@link android.R.attr#maxAspectRatio}.
234 * @hide
235 */
236 public float maxAspectRatio;
237
238 /**
Adrian Roos917791e2018-11-28 16:30:44 +0100239 * Value indicating the minimum aspect ratio the activity supports.
240 * <p>
241 * 0 means unset.
242 * @See {@link android.R.attr#minAspectRatio}.
243 * @hide
244 */
245 public float minAspectRatio;
246
247 /**
Ruben Brunkf56c9f42016-04-22 18:20:55 -0700248 * Name of the VrListenerService component to run for this activity.
249 * @see android.R.attr#enableVrMode
250 * @hide
251 */
252 public String requestedVrComponent;
253
254 /**
Romain Guy48327452017-01-23 17:03:35 -0800255 * Value for {@link #colorMode} indicating that the activity should use the
256 * default color mode (sRGB, low dynamic range).
257 *
258 * @see android.R.attr#colorMode
259 */
260 public static final int COLOR_MODE_DEFAULT = 0;
261 /**
262 * Value of {@link #colorMode} indicating that the activity should use a
263 * wide color gamut if the presentation display supports it.
264 *
265 * @see android.R.attr#colorMode
266 */
267 public static final int COLOR_MODE_WIDE_COLOR_GAMUT = 1;
268 /**
269 * Value of {@link #colorMode} indicating that the activity should use a
270 * high dynamic range if the presentation display supports it.
271 *
272 * @see android.R.attr#colorMode
273 */
274 public static final int COLOR_MODE_HDR = 2;
275
276 /** @hide */
Jeff Sharkeyce8db992017-12-13 20:05:05 -0700277 @IntDef(prefix = { "COLOR_MODE_" }, value = {
278 COLOR_MODE_DEFAULT,
279 COLOR_MODE_WIDE_COLOR_GAMUT,
280 COLOR_MODE_HDR,
Romain Guy48327452017-01-23 17:03:35 -0800281 })
282 @Retention(RetentionPolicy.SOURCE)
283 public @interface ColorMode {}
284
285 /**
286 * The color mode requested by this activity. The target display may not be
287 * able to honor the request.
288 */
289 @ColorMode
290 public int colorMode = COLOR_MODE_DEFAULT;
291
292 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800293 * Bit in {@link #flags} indicating whether this activity is able to
294 * run in multiple processes. If
295 * true, the system may instantiate it in the some process as the
296 * process starting it in order to conserve resources. If false, the
297 * default, it always runs in {@link #processName}. Set from the
298 * {@link android.R.attr#multiprocess} attribute.
299 */
300 public static final int FLAG_MULTIPROCESS = 0x0001;
301 /**
302 * Bit in {@link #flags} indicating that, when the activity's task is
303 * relaunched from home, this activity should be finished.
304 * Set from the
305 * {@link android.R.attr#finishOnTaskLaunch} attribute.
306 */
307 public static final int FLAG_FINISH_ON_TASK_LAUNCH = 0x0002;
308 /**
309 * Bit in {@link #flags} indicating that, when the activity is the root
310 * of a task, that task's stack should be cleared each time the user
311 * re-launches it from home. As a result, the user will always
312 * return to the original activity at the top of the task.
313 * This flag only applies to activities that
314 * are used to start the root of a new task. Set from the
315 * {@link android.R.attr#clearTaskOnLaunch} attribute.
316 */
317 public static final int FLAG_CLEAR_TASK_ON_LAUNCH = 0x0004;
318 /**
319 * Bit in {@link #flags} indicating that, when the activity is the root
320 * of a task, that task's stack should never be cleared when it is
321 * relaunched from home. Set from the
322 * {@link android.R.attr#alwaysRetainTaskState} attribute.
323 */
324 public static final int FLAG_ALWAYS_RETAIN_TASK_STATE = 0x0008;
325 /**
326 * Bit in {@link #flags} indicating that the activity's state
327 * is not required to be saved, so that if there is a failure the
328 * activity will not be removed from the activity stack. Set from the
329 * {@link android.R.attr#stateNotNeeded} attribute.
330 */
331 public static final int FLAG_STATE_NOT_NEEDED = 0x0010;
332 /**
333 * Bit in {@link #flags} that indicates that the activity should not
334 * appear in the list of recently launched activities. Set from the
335 * {@link android.R.attr#excludeFromRecents} attribute.
336 */
337 public static final int FLAG_EXCLUDE_FROM_RECENTS = 0x0020;
338 /**
339 * Bit in {@link #flags} that indicates that the activity can be moved
340 * between tasks based on its task affinity. Set from the
341 * {@link android.R.attr#allowTaskReparenting} attribute.
342 */
343 public static final int FLAG_ALLOW_TASK_REPARENTING = 0x0040;
344 /**
345 * Bit in {@link #flags} indicating that, when the user navigates away
346 * from an activity, it should be finished.
347 * Set from the
348 * {@link android.R.attr#noHistory} attribute.
349 */
350 public static final int FLAG_NO_HISTORY = 0x0080;
351 /**
Dianne Hackbornffa42482009-09-23 22:20:11 -0700352 * Bit in {@link #flags} indicating that, when a request to close system
353 * windows happens, this activity is finished.
354 * Set from the
355 * {@link android.R.attr#finishOnCloseSystemDialogs} attribute.
356 */
357 public static final int FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS = 0x0100;
Dianne Hackborn327fbd22011-01-17 14:38:50 -0800358 /**
359 * Value for {@link #flags}: true when the application's rendering should
360 * be hardware accelerated.
361 */
362 public static final int FLAG_HARDWARE_ACCELERATED = 0x0200;
363 /**
Wale Ogunwale6dfdfd62015-04-15 12:01:38 -0700364 * Value for {@link #flags}: true when the application can be displayed for all users
365 * regardless of if the user of the application is the current user. Set from the
366 * {@link android.R.attr#showForAllUsers} attribute.
Craig Mautner5962b122012-10-05 14:45:52 -0700367 * @hide
368 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +0100369 @UnsupportedAppUsage
Wale Ogunwale6dfdfd62015-04-15 12:01:38 -0700370 public static final int FLAG_SHOW_FOR_ALL_USERS = 0x0400;
Craig Mautner5962b122012-10-05 14:45:52 -0700371 /**
John Spurlock322d7712013-09-05 02:39:46 +0000372 * Bit in {@link #flags} corresponding to an immersive activity
Daniel Sandler613dde42010-06-21 13:46:39 -0400373 * that wishes not to be interrupted by notifications.
374 * Applications that hide the system notification bar with
375 * {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN}
376 * may still be interrupted by high-priority notifications; for example, an
377 * incoming phone call may use
Daniel Sandler8091ca52010-06-22 13:58:46 -0400378 * {@link android.app.Notification#fullScreenIntent fullScreenIntent}
Daniel Sandler613dde42010-06-21 13:46:39 -0400379 * to present a full-screen in-call activity to the user, pausing the
380 * current activity as a side-effect. An activity with
381 * {@link #FLAG_IMMERSIVE} set, however, will not be interrupted; the
382 * notification may be shown in some other way (such as a small floating
383 * "toast" window).
Christopher Tate73c2aee2012-03-15 16:27:14 -0700384 *
385 * Note that this flag will always reflect the Activity's
386 * <code>android:immersive</code> manifest definition, even if the Activity's
387 * immersive state is changed at runtime via
388 * {@link android.app.Activity#setImmersive(boolean)}.
389 *
390 * @see android.app.Notification#FLAG_HIGH_PRIORITY
391 * @see android.app.Activity#setImmersive(boolean)
Daniel Sandler613dde42010-06-21 13:46:39 -0400392 */
Craig Mautner5962b122012-10-05 14:45:52 -0700393 public static final int FLAG_IMMERSIVE = 0x0800;
Romain Guy529b60a2010-08-03 18:05:47 -0700394 /**
Craig Mautner9d4e9bc2014-06-18 18:34:56 -0700395 * Bit in {@link #flags}: If set, a task rooted at this activity will have its
396 * baseIntent replaced by the activity immediately above this. Each activity may further
397 * relinquish its identity to the activity above it using this flag. Set from the
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700398 * {@link android.R.attr#relinquishTaskIdentity} attribute.
Craig Mautner9d4e9bc2014-06-18 18:34:56 -0700399 */
400 public static final int FLAG_RELINQUISH_TASK_IDENTITY = 0x1000;
401 /**
Craig Mautner2dac0562014-05-06 09:06:44 -0700402 * Bit in {@link #flags} indicating that tasks started with this activity are to be
403 * removed from the recent list of tasks when the last activity in the task is finished.
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700404 * Corresponds to {@link android.R.attr#autoRemoveFromRecents}
Craig Mautner2dac0562014-05-06 09:06:44 -0700405 */
406 public static final int FLAG_AUTO_REMOVE_FROM_RECENTS = 0x2000;
407 /**
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700408 * Bit in {@link #flags} indicating that this activity can start is creation/resume
409 * while the previous activity is still pausing. Corresponds to
410 * {@link android.R.attr#resumeWhilePausing}
411 */
412 public static final int FLAG_RESUME_WHILE_PAUSING = 0x4000;
413 /**
Ruben Brunkdd18a0b2015-12-04 16:16:31 -0800414 * Bit in {@link #flags} indicating that this activity should be run with VR mode enabled.
415 *
Aurimas Liutikas7f695332018-05-31 21:07:32 -0700416 * @see android.app.Activity#setVrModeEnabled(boolean, ComponentName)
Ruben Brunkdd18a0b2015-12-04 16:16:31 -0800417 */
418 public static final int FLAG_ENABLE_VR_MODE = 0x8000;
Wale Ogunwale6cae7652015-12-26 07:36:26 -0800419
420 /**
Wale Ogunwale6cae7652015-12-26 07:36:26 -0800421 * Bit in {@link #flags} indicating if the activity is always focusable regardless of if it is
422 * in a task/stack whose activities are normally not focusable.
423 * See android.R.attr#alwaysFocusable.
424 * @hide
425 */
426 public static final int FLAG_ALWAYS_FOCUSABLE = 0x40000;
427
Ruben Brunkdd18a0b2015-12-04 16:16:31 -0800428 /**
Todd Kennedyc05f5d12017-04-25 11:11:40 -0700429 * Bit in {@link #flags} indicating if the activity is visible to instant
430 * applications. The activity is visible if it's either implicitly or
431 * explicitly exposed.
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800432 * @hide
433 */
Todd Kennedyc05f5d12017-04-25 11:11:40 -0700434 public static final int FLAG_VISIBLE_TO_INSTANT_APP = 0x100000;
435
436 /**
437 * Bit in {@link #flags} indicating if the activity is implicitly visible
438 * to instant applications. Implicitly visible activities are those that
439 * implement certain intent-filters:
440 * <ul>
441 * <li>action {@link Intent#CATEGORY_BROWSABLE}</li>
442 * <li>action {@link Intent#ACTION_SEND}</li>
443 * <li>action {@link Intent#ACTION_SENDTO}</li>
444 * <li>action {@link Intent#ACTION_SEND_MULTIPLE}</li>
445 * </ul>
446 * @hide
447 */
448 public static final int FLAG_IMPLICITLY_VISIBLE_TO_INSTANT_APP = 0x200000;
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800449
450 /**
Winson Chungd3395382016-12-13 11:49:09 -0800451 * Bit in {@link #flags} indicating if the activity supports picture-in-picture mode.
452 * See {@link android.R.attr#supportsPictureInPicture}.
453 * @hide
454 */
Todd Kennedyc05f5d12017-04-25 11:11:40 -0700455 public static final int FLAG_SUPPORTS_PICTURE_IN_PICTURE = 0x400000;
chaviw59b98852017-06-13 12:05:44 -0700456
457 /**
458 * Bit in {@link #flags} indicating if the activity should be shown when locked.
459 * See {@link android.R.attr#showWhenLocked}
460 * @hide
461 */
462 public static final int FLAG_SHOW_WHEN_LOCKED = 0x800000;
463
464 /**
465 * Bit in {@link #flags} indicating if the screen should turn on when starting the activity.
466 * See {@link android.R.attr#turnScreenOn}
467 * @hide
468 */
469 public static final int FLAG_TURN_SCREEN_ON = 0x1000000;
470
Winson Chungd3395382016-12-13 11:49:09 -0800471 /**
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -0700472 * @hide Bit in {@link #flags}: If set, this component will only be seen
Fyodor Kupolov4f5de342015-08-25 10:08:45 -0700473 * by the system user. Only works with broadcast receivers. Set from the
474 * android.R.attr#systemUserOnly attribute.
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -0700475 */
Fyodor Kupolov4f5de342015-08-25 10:08:45 -0700476 public static final int FLAG_SYSTEM_USER_ONLY = 0x20000000;
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -0700477 /**
Dianne Hackborn7d19e022012-08-07 19:12:33 -0700478 * Bit in {@link #flags}: If set, a single instance of the receiver will
479 * run for all users on the device. Set from the
480 * {@link android.R.attr#singleUser} attribute. Note that this flag is
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -0700481 * only relevant for ActivityInfo structures that are describing receiver
Dianne Hackborn7d19e022012-08-07 19:12:33 -0700482 * components; it is not applied to activities.
483 */
484 public static final int FLAG_SINGLE_USER = 0x40000000;
485 /**
Craig Mautnerffd14a12014-04-23 21:38:50 -0700486 * @hide Bit in {@link #flags}: If set, this activity may be launched into an
487 * owned ActivityContainer such as that within an ActivityView. If not set and
Svet Ganovf2acc542015-11-06 09:02:00 -0800488 * this activity is launched into such a container a SecurityException will be
Craig Mautnerffd14a12014-04-23 21:38:50 -0700489 * thrown. Set from the {@link android.R.attr#allowEmbedded} attribute.
490 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +0100491 @UnsupportedAppUsage
Craig Mautnerffd14a12014-04-23 21:38:50 -0700492 public static final int FLAG_ALLOW_EMBEDDED = 0x80000000;
chaviw59b98852017-06-13 12:05:44 -0700493
Craig Mautnerffd14a12014-04-23 21:38:50 -0700494 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800495 * Options that have been set in the activity declaration in the
Daniel Sandler613dde42010-06-21 13:46:39 -0400496 * manifest.
497 * These include:
498 * {@link #FLAG_MULTIPROCESS},
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800499 * {@link #FLAG_FINISH_ON_TASK_LAUNCH}, {@link #FLAG_CLEAR_TASK_ON_LAUNCH},
500 * {@link #FLAG_ALWAYS_RETAIN_TASK_STATE},
501 * {@link #FLAG_STATE_NOT_NEEDED}, {@link #FLAG_EXCLUDE_FROM_RECENTS},
Dianne Hackbornffa42482009-09-23 22:20:11 -0700502 * {@link #FLAG_ALLOW_TASK_REPARENTING}, {@link #FLAG_NO_HISTORY},
Daniel Sandler613dde42010-06-21 13:46:39 -0400503 * {@link #FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS},
Dianne Hackborn7d19e022012-08-07 19:12:33 -0700504 * {@link #FLAG_HARDWARE_ACCELERATED}, {@link #FLAG_SINGLE_USER}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800505 */
506 public int flags;
507
Issei Suzuki74e1eb22018-12-20 17:42:52 +0100508 /**
509 * Bit in {@link #privateFlags} indicating if the activity should be shown when locked in case
510 * an activity behind this can also be shown when locked.
wilsonshihd9841fb2019-01-23 16:36:17 +0800511 * See {@link android.R.attr#inheritShowWhenLocked}.
Issei Suzuki74e1eb22018-12-20 17:42:52 +0100512 * @hide
513 */
514 public static final int FLAG_INHERIT_SHOW_WHEN_LOCKED = 0x1;
515
516 /**
517 * Options that have been set in the activity declaration in the manifest.
518 * These include:
519 * {@link #FLAG_INHERIT_SHOW_WHEN_LOCKED}.
520 * @hide
521 */
522 public int privateFlags;
523
Tor Norbyed9273d62013-05-30 15:59:53 -0700524 /** @hide */
Jeff Sharkeyce8db992017-12-13 20:05:05 -0700525 @IntDef(prefix = { "SCREEN_ORIENTATION_" }, value = {
Wale Ogunwale51362492016-09-08 17:49:17 -0700526 SCREEN_ORIENTATION_UNSET,
Tor Norbyed9273d62013-05-30 15:59:53 -0700527 SCREEN_ORIENTATION_UNSPECIFIED,
528 SCREEN_ORIENTATION_LANDSCAPE,
529 SCREEN_ORIENTATION_PORTRAIT,
530 SCREEN_ORIENTATION_USER,
531 SCREEN_ORIENTATION_BEHIND,
532 SCREEN_ORIENTATION_SENSOR,
533 SCREEN_ORIENTATION_NOSENSOR,
534 SCREEN_ORIENTATION_SENSOR_LANDSCAPE,
535 SCREEN_ORIENTATION_SENSOR_PORTRAIT,
536 SCREEN_ORIENTATION_REVERSE_LANDSCAPE,
537 SCREEN_ORIENTATION_REVERSE_PORTRAIT,
538 SCREEN_ORIENTATION_FULL_SENSOR,
539 SCREEN_ORIENTATION_USER_LANDSCAPE,
540 SCREEN_ORIENTATION_USER_PORTRAIT,
541 SCREEN_ORIENTATION_FULL_USER,
542 SCREEN_ORIENTATION_LOCKED
543 })
544 @Retention(RetentionPolicy.SOURCE)
545 public @interface ScreenOrientation {}
546
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800547 /**
Wale Ogunwale51362492016-09-08 17:49:17 -0700548 * Internal constant used to indicate that the app didn't set a specific orientation value.
549 * Different from {@link #SCREEN_ORIENTATION_UNSPECIFIED} below as the app can set its
550 * orientation to {@link #SCREEN_ORIENTATION_UNSPECIFIED} while this means that the app didn't
551 * set anything. The system will mostly treat this similar to
552 * {@link #SCREEN_ORIENTATION_UNSPECIFIED}.
553 * @hide
554 */
555 public static final int SCREEN_ORIENTATION_UNSET = -2;
556 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800557 * Constant corresponding to <code>unspecified</code> in
558 * the {@link android.R.attr#screenOrientation} attribute.
559 */
560 public static final int SCREEN_ORIENTATION_UNSPECIFIED = -1;
561 /**
562 * Constant corresponding to <code>landscape</code> in
563 * the {@link android.R.attr#screenOrientation} attribute.
564 */
565 public static final int SCREEN_ORIENTATION_LANDSCAPE = 0;
566 /**
567 * Constant corresponding to <code>portrait</code> in
568 * the {@link android.R.attr#screenOrientation} attribute.
569 */
570 public static final int SCREEN_ORIENTATION_PORTRAIT = 1;
571 /**
572 * Constant corresponding to <code>user</code> in
573 * the {@link android.R.attr#screenOrientation} attribute.
574 */
575 public static final int SCREEN_ORIENTATION_USER = 2;
576 /**
577 * Constant corresponding to <code>behind</code> in
578 * the {@link android.R.attr#screenOrientation} attribute.
579 */
580 public static final int SCREEN_ORIENTATION_BEHIND = 3;
581 /**
582 * Constant corresponding to <code>sensor</code> in
583 * the {@link android.R.attr#screenOrientation} attribute.
584 */
585 public static final int SCREEN_ORIENTATION_SENSOR = 4;
Filip Gruszczynskid2f1d942015-10-14 15:10:12 -0700586
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800587 /**
Dianne Hackborne5439f22010-10-02 16:53:50 -0700588 * Constant corresponding to <code>nosensor</code> in
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800589 * the {@link android.R.attr#screenOrientation} attribute.
590 */
591 public static final int SCREEN_ORIENTATION_NOSENSOR = 5;
Dianne Hackborne5439f22010-10-02 16:53:50 -0700592
593 /**
594 * Constant corresponding to <code>sensorLandscape</code> in
595 * the {@link android.R.attr#screenOrientation} attribute.
596 */
597 public static final int SCREEN_ORIENTATION_SENSOR_LANDSCAPE = 6;
598
599 /**
600 * Constant corresponding to <code>sensorPortrait</code> in
601 * the {@link android.R.attr#screenOrientation} attribute.
602 */
603 public static final int SCREEN_ORIENTATION_SENSOR_PORTRAIT = 7;
604
605 /**
606 * Constant corresponding to <code>reverseLandscape</code> in
607 * the {@link android.R.attr#screenOrientation} attribute.
608 */
609 public static final int SCREEN_ORIENTATION_REVERSE_LANDSCAPE = 8;
610
611 /**
612 * Constant corresponding to <code>reversePortrait</code> in
613 * the {@link android.R.attr#screenOrientation} attribute.
614 */
615 public static final int SCREEN_ORIENTATION_REVERSE_PORTRAIT = 9;
616
617 /**
618 * Constant corresponding to <code>fullSensor</code> in
619 * the {@link android.R.attr#screenOrientation} attribute.
620 */
621 public static final int SCREEN_ORIENTATION_FULL_SENSOR = 10;
622
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800623 /**
Dianne Hackbornb9ec1ac2013-04-10 17:34:25 -0700624 * Constant corresponding to <code>userLandscape</code> in
625 * the {@link android.R.attr#screenOrientation} attribute.
626 */
627 public static final int SCREEN_ORIENTATION_USER_LANDSCAPE = 11;
628
629 /**
630 * Constant corresponding to <code>userPortrait</code> in
631 * the {@link android.R.attr#screenOrientation} attribute.
632 */
633 public static final int SCREEN_ORIENTATION_USER_PORTRAIT = 12;
634
635 /**
636 * Constant corresponding to <code>fullUser</code> in
637 * the {@link android.R.attr#screenOrientation} attribute.
638 */
639 public static final int SCREEN_ORIENTATION_FULL_USER = 13;
640
641 /**
642 * Constant corresponding to <code>locked</code> in
643 * the {@link android.R.attr#screenOrientation} attribute.
644 */
645 public static final int SCREEN_ORIENTATION_LOCKED = 14;
646
647 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800648 * The preferred screen orientation this activity would like to run in.
649 * From the {@link android.R.attr#screenOrientation} attribute, one of
650 * {@link #SCREEN_ORIENTATION_UNSPECIFIED},
Filip Gruszczynskid2f1d942015-10-14 15:10:12 -0700651 * {@link #SCREEN_ORIENTATION_LANDSCAPE},
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800652 * {@link #SCREEN_ORIENTATION_PORTRAIT},
653 * {@link #SCREEN_ORIENTATION_USER},
654 * {@link #SCREEN_ORIENTATION_BEHIND},
655 * {@link #SCREEN_ORIENTATION_SENSOR},
Dianne Hackborne5439f22010-10-02 16:53:50 -0700656 * {@link #SCREEN_ORIENTATION_NOSENSOR},
657 * {@link #SCREEN_ORIENTATION_SENSOR_LANDSCAPE},
658 * {@link #SCREEN_ORIENTATION_SENSOR_PORTRAIT},
659 * {@link #SCREEN_ORIENTATION_REVERSE_LANDSCAPE},
660 * {@link #SCREEN_ORIENTATION_REVERSE_PORTRAIT},
Dianne Hackbornb9ec1ac2013-04-10 17:34:25 -0700661 * {@link #SCREEN_ORIENTATION_FULL_SENSOR},
662 * {@link #SCREEN_ORIENTATION_USER_LANDSCAPE},
663 * {@link #SCREEN_ORIENTATION_USER_PORTRAIT},
664 * {@link #SCREEN_ORIENTATION_FULL_USER},
665 * {@link #SCREEN_ORIENTATION_LOCKED},
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800666 */
Tor Norbyed9273d62013-05-30 15:59:53 -0700667 @ScreenOrientation
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800668 public int screenOrientation = SCREEN_ORIENTATION_UNSPECIFIED;
Filip Gruszczynskid2f1d942015-10-14 15:10:12 -0700669
Alan Viveretteac85f902016-03-11 15:15:51 -0500670 /** @hide */
Jeff Sharkeyce8db992017-12-13 20:05:05 -0700671 @IntDef(flag = true, prefix = { "CONFIG_" }, value = {
672 CONFIG_MCC,
673 CONFIG_MNC,
674 CONFIG_LOCALE,
675 CONFIG_TOUCHSCREEN,
676 CONFIG_KEYBOARD,
677 CONFIG_KEYBOARD_HIDDEN,
678 CONFIG_NAVIGATION,
679 CONFIG_ORIENTATION,
680 CONFIG_SCREEN_LAYOUT,
681 CONFIG_UI_MODE,
682 CONFIG_SCREEN_SIZE,
683 CONFIG_SMALLEST_SCREEN_SIZE,
684 CONFIG_DENSITY,
685 CONFIG_LAYOUT_DIRECTION,
686 CONFIG_COLOR_MODE,
687 CONFIG_FONT_SCALE,
688 })
Alan Viveretteac85f902016-03-11 15:15:51 -0500689 @Retention(RetentionPolicy.SOURCE)
690 public @interface Config {}
691
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800692 /**
693 * Bit in {@link #configChanges} that indicates that the activity
694 * can itself handle changes to the IMSI MCC. Set from the
695 * {@link android.R.attr#configChanges} attribute.
696 */
697 public static final int CONFIG_MCC = 0x0001;
698 /**
699 * Bit in {@link #configChanges} that indicates that the activity
700 * can itself handle changes to the IMSI MNC. Set from the
701 * {@link android.R.attr#configChanges} attribute.
702 */
703 public static final int CONFIG_MNC = 0x0002;
704 /**
705 * Bit in {@link #configChanges} that indicates that the activity
706 * can itself handle changes to the locale. Set from the
707 * {@link android.R.attr#configChanges} attribute.
708 */
709 public static final int CONFIG_LOCALE = 0x0004;
710 /**
711 * Bit in {@link #configChanges} that indicates that the activity
712 * can itself handle changes to the touchscreen type. Set from the
713 * {@link android.R.attr#configChanges} attribute.
714 */
715 public static final int CONFIG_TOUCHSCREEN = 0x0008;
716 /**
717 * Bit in {@link #configChanges} that indicates that the activity
718 * can itself handle changes to the keyboard type. Set from the
719 * {@link android.R.attr#configChanges} attribute.
720 */
721 public static final int CONFIG_KEYBOARD = 0x0010;
722 /**
723 * Bit in {@link #configChanges} that indicates that the activity
Dianne Hackborn93e462b2009-09-15 22:50:40 -0700724 * can itself handle changes to the keyboard or navigation being hidden/exposed.
725 * Note that inspite of the name, this applies to the changes to any
726 * hidden states: keyboard or navigation.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800727 * Set from the {@link android.R.attr#configChanges} attribute.
728 */
729 public static final int CONFIG_KEYBOARD_HIDDEN = 0x0020;
730 /**
731 * Bit in {@link #configChanges} that indicates that the activity
732 * can itself handle changes to the navigation type. Set from the
733 * {@link android.R.attr#configChanges} attribute.
734 */
735 public static final int CONFIG_NAVIGATION = 0x0040;
736 /**
737 * Bit in {@link #configChanges} that indicates that the activity
738 * can itself handle changes to the screen orientation. Set from the
739 * {@link android.R.attr#configChanges} attribute.
740 */
741 public static final int CONFIG_ORIENTATION = 0x0080;
742 /**
743 * Bit in {@link #configChanges} that indicates that the activity
Dianne Hackborn723738c2009-06-25 19:48:04 -0700744 * can itself handle changes to the screen layout. Set from the
745 * {@link android.R.attr#configChanges} attribute.
746 */
747 public static final int CONFIG_SCREEN_LAYOUT = 0x0100;
748 /**
749 * Bit in {@link #configChanges} that indicates that the activity
Tobias Haamel27b28b32010-02-09 23:09:17 +0100750 * can itself handle the ui mode. Set from the
751 * {@link android.R.attr#configChanges} attribute.
Tobias Haamel27b28b32010-02-09 23:09:17 +0100752 */
753 public static final int CONFIG_UI_MODE = 0x0200;
754 /**
755 * Bit in {@link #configChanges} that indicates that the activity
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700756 * can itself handle the screen size. Set from the
Dianne Hackborne6676352011-06-01 16:51:20 -0700757 * {@link android.R.attr#configChanges} attribute. This will be
758 * set by default for applications that target an earlier version
759 * than {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}...
760 * <b>however</b>, you will not see the bit set here becomes some
761 * applications incorrectly compare {@link #configChanges} against
762 * an absolute value rather than correctly masking out the bits
763 * they are interested in. Please don't do that, thanks.
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700764 */
765 public static final int CONFIG_SCREEN_SIZE = 0x0400;
766 /**
767 * Bit in {@link #configChanges} that indicates that the activity
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700768 * can itself handle the smallest screen size. Set from the
Dianne Hackborne6676352011-06-01 16:51:20 -0700769 * {@link android.R.attr#configChanges} attribute. This will be
770 * set by default for applications that target an earlier version
771 * than {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}...
772 * <b>however</b>, you will not see the bit set here becomes some
773 * applications incorrectly compare {@link #configChanges} against
774 * an absolute value rather than correctly masking out the bits
775 * they are interested in. Please don't do that, thanks.
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700776 */
777 public static final int CONFIG_SMALLEST_SCREEN_SIZE = 0x0800;
778 /**
779 * Bit in {@link #configChanges} that indicates that the activity
Dianne Hackborn908aecc2012-07-31 16:37:34 -0700780 * can itself handle density changes. Set from the
781 * {@link android.R.attr#configChanges} attribute.
782 */
783 public static final int CONFIG_DENSITY = 0x1000;
784 /**
785 * Bit in {@link #configChanges} that indicates that the activity
Fabrice Di Meglio5f797992012-06-15 20:16:41 -0700786 * can itself handle the change to layout direction. Set from the
787 * {@link android.R.attr#configChanges} attribute.
788 */
789 public static final int CONFIG_LAYOUT_DIRECTION = 0x2000;
790 /**
791 * Bit in {@link #configChanges} that indicates that the activity
Romain Guyc9ba5592017-01-18 16:34:42 -0800792 * can itself handle the change to the display color gamut or dynamic
793 * range. Set from the {@link android.R.attr#configChanges} attribute.
794 */
Romain Guy48327452017-01-23 17:03:35 -0800795 public static final int CONFIG_COLOR_MODE = 0x4000;
Romain Guyc9ba5592017-01-18 16:34:42 -0800796 /**
797 * Bit in {@link #configChanges} that indicates that the activity
MÃ¥rten Kongstad49a4a1d2017-01-12 08:36:37 +0100798 * can itself handle asset path changes. Set from the {@link android.R.attr#configChanges}
799 * attribute. This is not a core resource configuration, but a higher-level value, so its
800 * constant starts at the high bits.
801 * @hide We do not want apps handling this yet, but we do need some kind of bit for diffs.
802 */
803 public static final int CONFIG_ASSETS_PATHS = 0x80000000;
804 /**
805 * Bit in {@link #configChanges} that indicates that the activity
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800806 * can itself handle changes to the font scaling factor. Set from the
807 * {@link android.R.attr#configChanges} attribute. This is
Fabrice Di Megliodc25d252013-04-09 18:04:29 -0700808 * not a core resource configuration, but a higher-level value, so its
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800809 * constant starts at the high bits.
810 */
811 public static final int CONFIG_FONT_SCALE = 0x40000000;
Wale Ogunwale822e5122017-07-26 06:02:24 -0700812 /**
813 * Bit indicating changes to window configuration that isn't exposed to apps.
814 * This is for internal use only and apps don't handle it.
815 * @hide
816 * {@link Configuration}.
817 */
818 public static final int CONFIG_WINDOW_CONFIGURATION = 0x20000000;
Filip Gruszczynskid2f1d942015-10-14 15:10:12 -0700819
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700820 /** @hide
821 * Unfortunately the constants for config changes in native code are
822 * different from ActivityInfo. :( Here are the values we should use for the
823 * native side given the bit we have assigned in ActivityInfo.
824 */
825 public static int[] CONFIG_NATIVE_BITS = new int[] {
Dianne Hackborn1d0b1772013-09-06 14:02:54 -0700826 Configuration.NATIVE_CONFIG_MNC, // MNC
827 Configuration.NATIVE_CONFIG_MCC, // MCC
828 Configuration.NATIVE_CONFIG_LOCALE, // LOCALE
829 Configuration.NATIVE_CONFIG_TOUCHSCREEN, // TOUCH SCREEN
830 Configuration.NATIVE_CONFIG_KEYBOARD, // KEYBOARD
831 Configuration.NATIVE_CONFIG_KEYBOARD_HIDDEN, // KEYBOARD HIDDEN
832 Configuration.NATIVE_CONFIG_NAVIGATION, // NAVIGATION
833 Configuration.NATIVE_CONFIG_ORIENTATION, // ORIENTATION
834 Configuration.NATIVE_CONFIG_SCREEN_LAYOUT, // SCREEN LAYOUT
835 Configuration.NATIVE_CONFIG_UI_MODE, // UI MODE
836 Configuration.NATIVE_CONFIG_SCREEN_SIZE, // SCREEN SIZE
837 Configuration.NATIVE_CONFIG_SMALLEST_SCREEN_SIZE, // SMALLEST SCREEN SIZE
838 Configuration.NATIVE_CONFIG_DENSITY, // DENSITY
839 Configuration.NATIVE_CONFIG_LAYOUTDIR, // LAYOUT DIRECTION
Romain Guy48327452017-01-23 17:03:35 -0800840 Configuration.NATIVE_CONFIG_COLOR_MODE, // COLOR_MODE
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700841 };
Alan Viverettec1d52792015-05-05 09:49:03 -0700842
843 /**
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700844 * Convert Java change bits to native.
Alan Viverettec1d52792015-05-05 09:49:03 -0700845 *
846 * @hide
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700847 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +0100848 @UnsupportedAppUsage
Alan Viveretteac85f902016-03-11 15:15:51 -0500849 public static @NativeConfig int activityInfoConfigJavaToNative(@Config int input) {
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700850 int output = 0;
Alan Viverettec1d52792015-05-05 09:49:03 -0700851 for (int i = 0; i < CONFIG_NATIVE_BITS.length; i++) {
852 if ((input & (1 << i)) != 0) {
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700853 output |= CONFIG_NATIVE_BITS[i];
854 }
855 }
856 return output;
857 }
858
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800859 /**
Alan Viverettec1d52792015-05-05 09:49:03 -0700860 * Convert native change bits to Java.
861 *
862 * @hide
863 */
Alan Viveretteac85f902016-03-11 15:15:51 -0500864 public static @Config int activityInfoConfigNativeToJava(@NativeConfig int input) {
Alan Viverettec1d52792015-05-05 09:49:03 -0700865 int output = 0;
866 for (int i = 0; i < CONFIG_NATIVE_BITS.length; i++) {
867 if ((input & CONFIG_NATIVE_BITS[i]) != 0) {
868 output |= (1 << i);
869 }
870 }
871 return output;
872 }
873
874 /**
Dianne Hackborne6676352011-06-01 16:51:20 -0700875 * @hide
876 * Unfortunately some developers (OpenFeint I am looking at you) have
877 * compared the configChanges bit field against absolute values, so if we
878 * introduce a new bit they break. To deal with that, we will make sure
879 * the public field will not have a value that breaks them, and let the
880 * framework call here to get the real value.
881 */
882 public int getRealConfigChanged() {
883 return applicationInfo.targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB_MR2
884 ? (configChanges | ActivityInfo.CONFIG_SCREEN_SIZE
885 | ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE)
886 : configChanges;
887 }
888
889 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800890 * Bit mask of kinds of configuration changes that this activity
891 * can handle itself (without being restarted by the system).
892 * Contains any combination of {@link #CONFIG_FONT_SCALE},
893 * {@link #CONFIG_MCC}, {@link #CONFIG_MNC},
894 * {@link #CONFIG_LOCALE}, {@link #CONFIG_TOUCHSCREEN},
Dianne Hackborn723738c2009-06-25 19:48:04 -0700895 * {@link #CONFIG_KEYBOARD}, {@link #CONFIG_NAVIGATION},
Alan Viverette28c4a0b2015-11-20 17:23:46 -0500896 * {@link #CONFIG_ORIENTATION}, {@link #CONFIG_SCREEN_LAYOUT},
Romain Guyc9ba5592017-01-18 16:34:42 -0800897 * {@link #CONFIG_DENSITY}, {@link #CONFIG_LAYOUT_DIRECTION} and
Romain Guy48327452017-01-23 17:03:35 -0800898 * {@link #CONFIG_COLOR_MODE}.
Alan Viverette28c4a0b2015-11-20 17:23:46 -0500899 * Set from the {@link android.R.attr#configChanges} attribute.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800900 */
901 public int configChanges;
Craig Mautner15df08a2015-04-01 12:17:18 -0700902
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800903 /**
904 * The desired soft input mode for this activity's main window.
905 * Set from the {@link android.R.attr#windowSoftInputMode} attribute
906 * in the activity's manifest. May be any of the same values allowed
907 * for {@link android.view.WindowManager.LayoutParams#softInputMode
908 * WindowManager.LayoutParams.softInputMode}. If 0 (unspecified),
909 * the mode from the theme will be used.
910 */
Yohei Yukawa22dac1c2017-02-12 16:54:16 -0800911 @android.view.WindowManager.LayoutParams.SoftInputModeFlags
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800912 public int softInputMode;
Adam Powell269248d2011-08-02 10:26:54 -0700913
914 /**
915 * The desired extra UI options for this activity and its main window.
916 * Set from the {@link android.R.attr#uiOptions} attribute in the
917 * activity's manifest.
918 */
919 public int uiOptions = 0;
920
921 /**
Scott Maine797ed62011-09-22 16:17:45 -0700922 * Flag for use with {@link #uiOptions}.
923 * Indicates that the action bar should put all action items in a separate bar when
924 * the screen is narrow.
925 * <p>This value corresponds to "splitActionBarWhenNarrow" for the {@link #uiOptions} XML
926 * attribute.
Adam Powell269248d2011-08-02 10:26:54 -0700927 */
928 public static final int UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW = 1;
929
Adam Powelldd8fab22012-03-22 17:47:27 -0700930 /**
931 * If defined, the activity named here is the logical parent of this activity.
932 */
933 public String parentActivityName;
934
Robert Carr0f5d7532016-10-17 16:39:17 -0700935 /**
936 * Screen rotation animation desired by the activity, with values as defined
937 * for {@link android.view.WindowManager.LayoutParams#rotationAnimation}.
Robert Carrc0149bf2017-05-01 15:22:22 -0700938 *
939 * -1 means to use the system default.
940 *
Robert Carr0f5d7532016-10-17 16:39:17 -0700941 * @hide
942 */
Robert Carrc0149bf2017-05-01 15:22:22 -0700943 public int rotationAnimation = -1;
Robert Carr0f5d7532016-10-17 16:39:17 -0700944
Craig Mautner15df08a2015-04-01 12:17:18 -0700945 /** @hide */
946 public static final int LOCK_TASK_LAUNCH_MODE_DEFAULT = 0;
947 /** @hide */
948 public static final int LOCK_TASK_LAUNCH_MODE_NEVER = 1;
949 /** @hide */
950 public static final int LOCK_TASK_LAUNCH_MODE_ALWAYS = 2;
951 /** @hide */
952 public static final int LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED = 3;
953
954 /** @hide */
955 public static final String lockTaskLaunchModeToString(int lockTaskLaunchMode) {
956 switch (lockTaskLaunchMode) {
957 case LOCK_TASK_LAUNCH_MODE_DEFAULT:
958 return "LOCK_TASK_LAUNCH_MODE_DEFAULT";
959 case LOCK_TASK_LAUNCH_MODE_NEVER:
960 return "LOCK_TASK_LAUNCH_MODE_NEVER";
961 case LOCK_TASK_LAUNCH_MODE_ALWAYS:
962 return "LOCK_TASK_LAUNCH_MODE_ALWAYS";
963 case LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED:
964 return "LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED";
965 default:
966 return "unknown=" + lockTaskLaunchMode;
967 }
968 }
969 /**
970 * Value indicating if the activity is to be locked at startup. Takes on the values from
971 * {@link android.R.attr#lockTaskMode}.
972 * @hide
973 */
974 public int lockTaskLaunchMode;
975
Andrii Kulian2e751b82016-03-16 16:59:32 -0700976 /**
977 * Information about desired position and size of activity on the display when
978 * it is first started.
979 */
980 public WindowLayout windowLayout;
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -0700981
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800982 public ActivityInfo() {
983 }
984
985 public ActivityInfo(ActivityInfo orig) {
986 super(orig);
987 theme = orig.theme;
988 launchMode = orig.launchMode;
Robert Carr3e2e0112015-09-15 12:30:42 -0700989 documentLaunchMode = orig.documentLaunchMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800990 permission = orig.permission;
991 taskAffinity = orig.taskAffinity;
992 targetActivity = orig.targetActivity;
993 flags = orig.flags;
Issei Suzuki74e1eb22018-12-20 17:42:52 +0100994 privateFlags = orig.privateFlags;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800995 screenOrientation = orig.screenOrientation;
996 configChanges = orig.configChanges;
997 softInputMode = orig.softInputMode;
Adam Powell269248d2011-08-02 10:26:54 -0700998 uiOptions = orig.uiOptions;
Adam Powelldd8fab22012-03-22 17:47:27 -0700999 parentActivityName = orig.parentActivityName;
Craig Mautner8307ea72014-09-11 15:03:53 -07001000 maxRecents = orig.maxRecents;
Craig Mautner15df08a2015-04-01 12:17:18 -07001001 lockTaskLaunchMode = orig.lockTaskLaunchMode;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001002 windowLayout = orig.windowLayout;
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001003 resizeMode = orig.resizeMode;
Ruben Brunkf56c9f42016-04-22 18:20:55 -07001004 requestedVrComponent = orig.requestedVrComponent;
Robert Carr0f5d7532016-10-17 16:39:17 -07001005 rotationAnimation = orig.rotationAnimation;
Romain Guy48327452017-01-23 17:03:35 -08001006 colorMode = orig.colorMode;
Wale Ogunwale55ddf8f2017-03-20 08:56:38 -07001007 maxAspectRatio = orig.maxAspectRatio;
Adrian Roos917791e2018-11-28 16:30:44 +01001008 minAspectRatio = orig.minAspectRatio;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001009 }
Craig Mautner15df08a2015-04-01 12:17:18 -07001010
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001011 /**
1012 * Return the theme resource identifier to use for this activity. If
1013 * the activity defines a theme, that is used; else, the application
1014 * theme is used.
Craig Mautner15df08a2015-04-01 12:17:18 -07001015 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001016 * @return The theme associated with this activity.
1017 */
1018 public final int getThemeResource() {
1019 return theme != 0 ? theme : applicationInfo.theme;
1020 }
1021
Craig Mautner43e52ed2014-06-16 17:18:52 -07001022 private String persistableModeToString() {
1023 switch(persistableMode) {
1024 case PERSIST_ROOT_ONLY: return "PERSIST_ROOT_ONLY";
Craig Mautner7f72f532014-07-21 10:07:12 -07001025 case PERSIST_NEVER: return "PERSIST_NEVER";
Craig Mautner43e52ed2014-06-16 17:18:52 -07001026 case PERSIST_ACROSS_REBOOTS: return "PERSIST_ACROSS_REBOOTS";
1027 default: return "UNKNOWN=" + persistableMode;
1028 }
1029 }
1030
Wale Ogunwale508ff552016-02-15 19:31:50 -08001031 /**
Riddle Hsu0a343c32018-12-21 00:40:48 +08001032 * Returns true if the activity has maximum or minimum aspect ratio.
1033 * @hide
1034 */
1035 public boolean hasFixedAspectRatio() {
1036 return maxAspectRatio != 0 || minAspectRatio != 0;
1037 }
1038
1039 /**
Wale Ogunwale508ff552016-02-15 19:31:50 -08001040 * Returns true if the activity's orientation is fixed.
1041 * @hide
1042 */
Riddle Hsu0a343c32018-12-21 00:40:48 +08001043 public boolean isFixedOrientation() {
skuhne@google.com322347b2016-12-02 12:54:03 -08001044 return isFixedOrientationLandscape() || isFixedOrientationPortrait()
Wale Ogunwale508ff552016-02-15 19:31:50 -08001045 || screenOrientation == SCREEN_ORIENTATION_LOCKED;
1046 }
1047
skuhne@google.com322347b2016-12-02 12:54:03 -08001048 /**
1049 * Returns true if the activity's orientation is fixed to landscape.
1050 * @hide
1051 */
1052 boolean isFixedOrientationLandscape() {
Wale Ogunwaled4b1d1e2017-04-10 06:35:59 -07001053 return isFixedOrientationLandscape(screenOrientation);
1054 }
1055
1056 /**
1057 * Returns true if the activity's orientation is fixed to landscape.
1058 * @hide
1059 */
1060 public static boolean isFixedOrientationLandscape(@ScreenOrientation int orientation) {
1061 return orientation == SCREEN_ORIENTATION_LANDSCAPE
1062 || orientation == SCREEN_ORIENTATION_SENSOR_LANDSCAPE
1063 || orientation == SCREEN_ORIENTATION_REVERSE_LANDSCAPE
1064 || orientation == SCREEN_ORIENTATION_USER_LANDSCAPE;
skuhne@google.com322347b2016-12-02 12:54:03 -08001065 }
1066
1067 /**
1068 * Returns true if the activity's orientation is fixed to portrait.
1069 * @hide
1070 */
1071 boolean isFixedOrientationPortrait() {
Wale Ogunwaled4b1d1e2017-04-10 06:35:59 -07001072 return isFixedOrientationPortrait(screenOrientation);
1073 }
1074
1075 /**
1076 * Returns true if the activity's orientation is fixed to portrait.
1077 * @hide
1078 */
1079 public static boolean isFixedOrientationPortrait(@ScreenOrientation int orientation) {
1080 return orientation == SCREEN_ORIENTATION_PORTRAIT
1081 || orientation == SCREEN_ORIENTATION_SENSOR_PORTRAIT
1082 || orientation == SCREEN_ORIENTATION_REVERSE_PORTRAIT
1083 || orientation == SCREEN_ORIENTATION_USER_PORTRAIT;
skuhne@google.com322347b2016-12-02 12:54:03 -08001084 }
1085
Winson Chungd3395382016-12-13 11:49:09 -08001086 /**
1087 * Returns true if the activity supports picture-in-picture.
1088 * @hide
1089 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01001090 @UnsupportedAppUsage
Winson Chungd3395382016-12-13 11:49:09 -08001091 public boolean supportsPictureInPicture() {
1092 return (flags & FLAG_SUPPORTS_PICTURE_IN_PICTURE) != 0;
1093 }
1094
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001095 /** @hide */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01001096 @UnsupportedAppUsage
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08001097 public static boolean isResizeableMode(int mode) {
Wale Ogunwaled829d362016-02-10 19:24:49 -08001098 return mode == RESIZE_MODE_RESIZEABLE
Wale Ogunwale72a73e32016-10-13 12:16:39 -07001099 || mode == RESIZE_MODE_FORCE_RESIZEABLE
skuhne@google.com322347b2016-12-02 12:54:03 -08001100 || mode == RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY
1101 || mode == RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY
1102 || mode == RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION
Wale Ogunwale72a73e32016-10-13 12:16:39 -07001103 || mode == RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION;
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08001104 }
1105
1106 /** @hide */
skuhne@google.com322347b2016-12-02 12:54:03 -08001107 public static boolean isPreserveOrientationMode(int mode) {
1108 return mode == RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY
1109 || mode == RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY
1110 || mode == RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION;
1111 }
1112
1113 /** @hide */
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08001114 public static String resizeModeToString(int mode) {
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001115 switch (mode) {
1116 case RESIZE_MODE_UNRESIZEABLE:
1117 return "RESIZE_MODE_UNRESIZEABLE";
Wale Ogunwale72a73e32016-10-13 12:16:39 -07001118 case RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION:
1119 return "RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION";
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001120 case RESIZE_MODE_RESIZEABLE:
1121 return "RESIZE_MODE_RESIZEABLE";
Wale Ogunwaled829d362016-02-10 19:24:49 -08001122 case RESIZE_MODE_FORCE_RESIZEABLE:
1123 return "RESIZE_MODE_FORCE_RESIZEABLE";
skuhne@google.com322347b2016-12-02 12:54:03 -08001124 case RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY:
1125 return "RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY";
1126 case RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY:
1127 return "RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY";
1128 case RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION:
1129 return "RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION";
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001130 default:
1131 return "unknown=" + mode;
1132 }
1133 }
1134
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001135 public void dump(Printer pw, String prefix) {
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001136 dump(pw, prefix, DUMP_FLAG_ALL);
1137 }
1138
1139 /** @hide */
Yohei Yukawa8f272172017-08-31 00:26:01 -07001140 public void dump(Printer pw, String prefix, int dumpFlags) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001141 super.dumpFront(pw, prefix);
Dianne Hackborn12527f92009-11-11 17:39:50 -08001142 if (permission != null) {
1143 pw.println(prefix + "permission=" + permission);
1144 }
Yohei Yukawa8f272172017-08-31 00:26:01 -07001145 if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001146 pw.println(prefix + "taskAffinity=" + taskAffinity
1147 + " targetActivity=" + targetActivity
1148 + " persistableMode=" + persistableModeToString());
1149 }
Issei Suzuki74e1eb22018-12-20 17:42:52 +01001150 if (launchMode != 0 || flags != 0 || privateFlags != 0 || theme != 0) {
Dianne Hackborn12527f92009-11-11 17:39:50 -08001151 pw.println(prefix + "launchMode=" + launchMode
1152 + " flags=0x" + Integer.toHexString(flags)
Issei Suzuki74e1eb22018-12-20 17:42:52 +01001153 + " privateFlags=0x" + Integer.toHexString(privateFlags)
Dianne Hackborn12527f92009-11-11 17:39:50 -08001154 + " theme=0x" + Integer.toHexString(theme));
1155 }
1156 if (screenOrientation != SCREEN_ORIENTATION_UNSPECIFIED
1157 || configChanges != 0 || softInputMode != 0) {
1158 pw.println(prefix + "screenOrientation=" + screenOrientation
1159 + " configChanges=0x" + Integer.toHexString(configChanges)
1160 + " softInputMode=0x" + Integer.toHexString(softInputMode));
1161 }
Adam Powell269248d2011-08-02 10:26:54 -07001162 if (uiOptions != 0) {
1163 pw.println(prefix + " uiOptions=0x" + Integer.toHexString(uiOptions));
1164 }
Yohei Yukawa8f272172017-08-31 00:26:01 -07001165 if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001166 pw.println(prefix + "lockTaskLaunchMode="
1167 + lockTaskLaunchModeToString(lockTaskLaunchMode));
1168 }
Andrii Kulian2e751b82016-03-16 16:59:32 -07001169 if (windowLayout != null) {
1170 pw.println(prefix + "windowLayout=" + windowLayout.width + "|"
1171 + windowLayout.widthFraction + ", " + windowLayout.height + "|"
1172 + windowLayout.heightFraction + ", " + windowLayout.gravity);
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001173 }
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001174 pw.println(prefix + "resizeMode=" + resizeModeToString(resizeMode));
Ruben Brunkf56c9f42016-04-22 18:20:55 -07001175 if (requestedVrComponent != null) {
1176 pw.println(prefix + "requestedVrComponent=" + requestedVrComponent);
1177 }
Wale Ogunwale55ddf8f2017-03-20 08:56:38 -07001178 if (maxAspectRatio != 0) {
1179 pw.println(prefix + "maxAspectRatio=" + maxAspectRatio);
1180 }
Adrian Roos917791e2018-11-28 16:30:44 +01001181 if (minAspectRatio != 0) {
1182 pw.println(prefix + "minAspectRatio=" + minAspectRatio);
1183 }
Yohei Yukawa8f272172017-08-31 00:26:01 -07001184 super.dumpBack(pw, prefix, dumpFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001185 }
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001186
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001187 public String toString() {
1188 return "ActivityInfo{"
1189 + Integer.toHexString(System.identityHashCode(this))
1190 + " " + name + "}";
1191 }
1192
1193 public int describeContents() {
1194 return 0;
1195 }
1196
1197 public void writeToParcel(Parcel dest, int parcelableFlags) {
1198 super.writeToParcel(dest, parcelableFlags);
1199 dest.writeInt(theme);
1200 dest.writeInt(launchMode);
Robert Carr3e2e0112015-09-15 12:30:42 -07001201 dest.writeInt(documentLaunchMode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001202 dest.writeString(permission);
1203 dest.writeString(taskAffinity);
1204 dest.writeString(targetActivity);
Andrii Kulian6b9d3a12017-11-16 14:36:36 -08001205 dest.writeString(launchToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001206 dest.writeInt(flags);
Issei Suzuki74e1eb22018-12-20 17:42:52 +01001207 dest.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001208 dest.writeInt(screenOrientation);
1209 dest.writeInt(configChanges);
1210 dest.writeInt(softInputMode);
Adam Powell269248d2011-08-02 10:26:54 -07001211 dest.writeInt(uiOptions);
Adam Powelldd8fab22012-03-22 17:47:27 -07001212 dest.writeString(parentActivityName);
Craig Mautner43e52ed2014-06-16 17:18:52 -07001213 dest.writeInt(persistableMode);
Craig Mautner8307ea72014-09-11 15:03:53 -07001214 dest.writeInt(maxRecents);
Craig Mautner15df08a2015-04-01 12:17:18 -07001215 dest.writeInt(lockTaskLaunchMode);
Andrii Kulian2e751b82016-03-16 16:59:32 -07001216 if (windowLayout != null) {
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001217 dest.writeInt(1);
Andrii Kulian2e751b82016-03-16 16:59:32 -07001218 dest.writeInt(windowLayout.width);
1219 dest.writeFloat(windowLayout.widthFraction);
1220 dest.writeInt(windowLayout.height);
1221 dest.writeFloat(windowLayout.heightFraction);
1222 dest.writeInt(windowLayout.gravity);
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001223 dest.writeInt(windowLayout.minWidth);
1224 dest.writeInt(windowLayout.minHeight);
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001225 } else {
1226 dest.writeInt(0);
1227 }
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001228 dest.writeInt(resizeMode);
Ruben Brunkf56c9f42016-04-22 18:20:55 -07001229 dest.writeString(requestedVrComponent);
Robert Carr0f5d7532016-10-17 16:39:17 -07001230 dest.writeInt(rotationAnimation);
Romain Guy48327452017-01-23 17:03:35 -08001231 dest.writeInt(colorMode);
Wale Ogunwale55ddf8f2017-03-20 08:56:38 -07001232 dest.writeFloat(maxAspectRatio);
Adrian Roos917791e2018-11-28 16:30:44 +01001233 dest.writeFloat(minAspectRatio);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001234 }
1235
Bryce Lee39791592017-04-26 09:29:12 -07001236 /**
1237 * Determines whether the {@link Activity} is considered translucent or floating.
1238 * @hide
1239 */
Wale Ogunwale30eab1f2018-05-24 18:25:25 -07001240 @TestApi
Bryce Lee39791592017-04-26 09:29:12 -07001241 public static boolean isTranslucentOrFloating(TypedArray attributes) {
1242 final boolean isTranslucent =
1243 attributes.getBoolean(com.android.internal.R.styleable.Window_windowIsTranslucent,
1244 false);
1245 final boolean isSwipeToDismiss = !attributes.hasValue(
1246 com.android.internal.R.styleable.Window_windowIsTranslucent)
1247 && attributes.getBoolean(
1248 com.android.internal.R.styleable.Window_windowSwipeToDismiss, false);
1249 final boolean isFloating =
1250 attributes.getBoolean(com.android.internal.R.styleable.Window_windowIsFloating,
1251 false);
1252
1253 return isFloating || isTranslucent || isSwipeToDismiss;
1254 }
1255
Michael Wright19859762017-09-18 20:57:58 +01001256 /**
1257 * Convert the screen orientation constant to a human readable format.
1258 * @hide
1259 */
1260 public static String screenOrientationToString(int orientation) {
Jorim Jaggi484851b2017-09-22 16:03:27 +02001261 switch (orientation) {
Michael Wright19859762017-09-18 20:57:58 +01001262 case SCREEN_ORIENTATION_UNSET:
1263 return "SCREEN_ORIENTATION_UNSET";
1264 case SCREEN_ORIENTATION_UNSPECIFIED:
1265 return "SCREEN_ORIENTATION_UNSPECIFIED";
1266 case SCREEN_ORIENTATION_LANDSCAPE:
1267 return "SCREEN_ORIENTATION_LANDSCAPE";
1268 case SCREEN_ORIENTATION_PORTRAIT:
1269 return "SCREEN_ORIENTATION_PORTRAIT";
1270 case SCREEN_ORIENTATION_USER:
1271 return "SCREEN_ORIENTATION_USER";
1272 case SCREEN_ORIENTATION_BEHIND:
1273 return "SCREEN_ORIENTATION_BEHIND";
1274 case SCREEN_ORIENTATION_SENSOR:
1275 return "SCREEN_ORIENTATION_SENSOR";
1276 case SCREEN_ORIENTATION_NOSENSOR:
1277 return "SCREEN_ORIENTATION_NOSENSOR";
1278 case SCREEN_ORIENTATION_SENSOR_LANDSCAPE:
1279 return "SCREEN_ORIENTATION_SENSOR_LANDSCAPE";
1280 case SCREEN_ORIENTATION_SENSOR_PORTRAIT:
1281 return "SCREEN_ORIENTATION_SENSOR_PORTRAIT";
1282 case SCREEN_ORIENTATION_REVERSE_LANDSCAPE:
1283 return "SCREEN_ORIENTATION_REVERSE_LANDSCAPE";
1284 case SCREEN_ORIENTATION_REVERSE_PORTRAIT:
1285 return "SCREEN_ORIENTATION_REVERSE_PORTRAIT";
1286 case SCREEN_ORIENTATION_FULL_SENSOR:
1287 return "SCREEN_ORIENTATION_FULL_SENSOR";
1288 case SCREEN_ORIENTATION_USER_LANDSCAPE:
1289 return "SCREEN_ORIENTATION_USER_LANDSCAPE";
1290 case SCREEN_ORIENTATION_USER_PORTRAIT:
1291 return "SCREEN_ORIENTATION_USER_PORTRAIT";
1292 case SCREEN_ORIENTATION_FULL_USER:
1293 return "SCREEN_ORIENTATION_FULL_USER";
1294 case SCREEN_ORIENTATION_LOCKED:
1295 return "SCREEN_ORIENTATION_LOCKED";
1296 default:
1297 return Integer.toString(orientation);
1298 }
1299 }
1300
Jorim Jaggi484851b2017-09-22 16:03:27 +02001301 /**
1302 * @hide
1303 */
1304 public static String colorModeToString(@ColorMode int colorMode) {
1305 switch (colorMode) {
1306 case COLOR_MODE_DEFAULT:
1307 return "COLOR_MODE_DEFAULT";
1308 case COLOR_MODE_WIDE_COLOR_GAMUT:
1309 return "COLOR_MODE_WIDE_COLOR_GAMUT";
1310 case COLOR_MODE_HDR:
1311 return "COLOR_MODE_HDR";
1312 default:
1313 return Integer.toString(colorMode);
1314 }
1315 }
1316
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -07001317 public static final @android.annotation.NonNull Parcelable.Creator<ActivityInfo> CREATOR
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001318 = new Parcelable.Creator<ActivityInfo>() {
1319 public ActivityInfo createFromParcel(Parcel source) {
1320 return new ActivityInfo(source);
1321 }
1322 public ActivityInfo[] newArray(int size) {
1323 return new ActivityInfo[size];
1324 }
1325 };
1326
1327 private ActivityInfo(Parcel source) {
1328 super(source);
1329 theme = source.readInt();
1330 launchMode = source.readInt();
Robert Carr3e2e0112015-09-15 12:30:42 -07001331 documentLaunchMode = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001332 permission = source.readString();
1333 taskAffinity = source.readString();
1334 targetActivity = source.readString();
Andrii Kulian6b9d3a12017-11-16 14:36:36 -08001335 launchToken = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001336 flags = source.readInt();
Issei Suzuki74e1eb22018-12-20 17:42:52 +01001337 privateFlags = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001338 screenOrientation = source.readInt();
1339 configChanges = source.readInt();
1340 softInputMode = source.readInt();
Adam Powell269248d2011-08-02 10:26:54 -07001341 uiOptions = source.readInt();
Adam Powelldd8fab22012-03-22 17:47:27 -07001342 parentActivityName = source.readString();
Craig Mautner43e52ed2014-06-16 17:18:52 -07001343 persistableMode = source.readInt();
Craig Mautner8307ea72014-09-11 15:03:53 -07001344 maxRecents = source.readInt();
Craig Mautner15df08a2015-04-01 12:17:18 -07001345 lockTaskLaunchMode = source.readInt();
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001346 if (source.readInt() == 1) {
Andrii Kulian2e751b82016-03-16 16:59:32 -07001347 windowLayout = new WindowLayout(source);
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001348 }
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001349 resizeMode = source.readInt();
Ruben Brunkf56c9f42016-04-22 18:20:55 -07001350 requestedVrComponent = source.readString();
Robert Carr0f5d7532016-10-17 16:39:17 -07001351 rotationAnimation = source.readInt();
Romain Guy48327452017-01-23 17:03:35 -08001352 colorMode = source.readInt();
Wale Ogunwale55ddf8f2017-03-20 08:56:38 -07001353 maxAspectRatio = source.readFloat();
Adrian Roos917791e2018-11-28 16:30:44 +01001354 minAspectRatio = source.readFloat();
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001355 }
1356
Andrii Kulian2e751b82016-03-16 16:59:32 -07001357 /**
1358 * Contains information about position and size of the activity on the display.
1359 *
1360 * Used in freeform mode to set desired position when activity is first launched.
1361 * It describes how big the activity wants to be in both width and height,
1362 * the minimal allowed size, and the gravity to be applied.
1363 *
1364 * @attr ref android.R.styleable#AndroidManifestLayout_defaultWidth
1365 * @attr ref android.R.styleable#AndroidManifestLayout_defaultHeight
1366 * @attr ref android.R.styleable#AndroidManifestLayout_gravity
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001367 * @attr ref android.R.styleable#AndroidManifestLayout_minWidth
1368 * @attr ref android.R.styleable#AndroidManifestLayout_minHeight
Andrii Kulian2e751b82016-03-16 16:59:32 -07001369 */
1370 public static final class WindowLayout {
1371 public WindowLayout(int width, float widthFraction, int height, float heightFraction, int gravity,
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001372 int minWidth, int minHeight) {
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001373 this.width = width;
1374 this.widthFraction = widthFraction;
1375 this.height = height;
1376 this.heightFraction = heightFraction;
1377 this.gravity = gravity;
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001378 this.minWidth = minWidth;
1379 this.minHeight = minHeight;
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001380 }
1381
Andrii Kulian2e751b82016-03-16 16:59:32 -07001382 WindowLayout(Parcel source) {
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001383 width = source.readInt();
1384 widthFraction = source.readFloat();
1385 height = source.readInt();
1386 heightFraction = source.readFloat();
1387 gravity = source.readInt();
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001388 minWidth = source.readInt();
1389 minHeight = source.readInt();
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001390 }
1391
Andrii Kulian2e751b82016-03-16 16:59:32 -07001392 /**
1393 * Width of activity in pixels.
1394 *
1395 * @attr ref android.R.styleable#AndroidManifestLayout_defaultWidth
1396 */
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001397 public final int width;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001398
1399 /**
1400 * Width of activity as a fraction of available display width.
1401 * If both {@link #width} and this value are set this one will be preferred.
1402 *
1403 * @attr ref android.R.styleable#AndroidManifestLayout_defaultWidth
1404 */
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001405 public final float widthFraction;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001406
1407 /**
1408 * Height of activity in pixels.
1409 *
1410 * @attr ref android.R.styleable#AndroidManifestLayout_defaultHeight
1411 */
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001412 public final int height;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001413
1414 /**
1415 * Height of activity as a fraction of available display height.
1416 * If both {@link #height} and this value are set this one will be preferred.
1417 *
1418 * @attr ref android.R.styleable#AndroidManifestLayout_defaultHeight
1419 */
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001420 public final float heightFraction;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001421
1422 /**
1423 * Gravity of activity.
1424 * Currently {@link android.view.Gravity#TOP}, {@link android.view.Gravity#BOTTOM},
1425 * {@link android.view.Gravity#LEFT} and {@link android.view.Gravity#RIGHT} are supported.
1426 *
1427 * @attr ref android.R.styleable#AndroidManifestLayout_gravity
1428 */
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001429 public final int gravity;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001430
1431 /**
1432 * Minimal width of activity in pixels to be able to display its content.
1433 *
1434 * <p><strong>NOTE:</strong> A task's root activity value is applied to all additional
1435 * activities launched in the task. That is if the root activity of a task set minimal
1436 * width, then the system will set the same minimal width on all other activities in the
1437 * task. It will also ignore any other minimal width attributes of non-root activities.
1438 *
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001439 * @attr ref android.R.styleable#AndroidManifestLayout_minWidth
Andrii Kulian2e751b82016-03-16 16:59:32 -07001440 */
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001441 public final int minWidth;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001442
1443 /**
1444 * Minimal height of activity in pixels to be able to display its content.
1445 *
1446 * <p><strong>NOTE:</strong> A task's root activity value is applied to all additional
1447 * activities launched in the task. That is if the root activity of a task set minimal
1448 * height, then the system will set the same minimal height on all other activities in the
1449 * task. It will also ignore any other minimal height attributes of non-root activities.
1450 *
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001451 * @attr ref android.R.styleable#AndroidManifestLayout_minHeight
Andrii Kulian2e751b82016-03-16 16:59:32 -07001452 */
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001453 public final int minHeight;
Garfield Tanb5cc09f2018-09-28 10:06:52 -07001454
1455 /**
1456 * Returns if this {@link WindowLayout} has specified bounds.
1457 * @hide
1458 */
1459 public boolean hasSpecifiedSize() {
1460 return width >= 0 || height >= 0 || widthFraction >= 0 || heightFraction >= 0;
1461 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001462 }
1463}