• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.content.pm;
18 
19 import android.annotation.FlaggedApi;
20 import android.annotation.FloatRange;
21 import android.annotation.IntDef;
22 import android.annotation.NonNull;
23 import android.annotation.Nullable;
24 import android.annotation.SuppressLint;
25 import android.annotation.TestApi;
26 import android.app.Activity;
27 import android.compat.annotation.ChangeId;
28 import android.compat.annotation.Disabled;
29 import android.compat.annotation.EnabledAfter;
30 import android.compat.annotation.EnabledSince;
31 import android.compat.annotation.Overridable;
32 import android.compat.annotation.UnsupportedAppUsage;
33 import android.content.ComponentName;
34 import android.content.Intent;
35 import android.content.res.Configuration;
36 import android.content.res.Configuration.NativeConfig;
37 import android.content.res.TypedArray;
38 import android.os.Build;
39 import android.os.Parcel;
40 import android.os.Parcelable;
41 import android.util.ArraySet;
42 import android.util.Printer;
43 import android.window.OnBackInvokedCallback;
44 
45 import com.android.internal.util.Parcelling;
46 import com.android.window.flags.Flags;
47 
48 import java.lang.annotation.Retention;
49 import java.lang.annotation.RetentionPolicy;
50 import java.util.Collections;
51 import java.util.Locale;
52 import java.util.Set;
53 
54 /**
55  * Information you can retrieve about a particular application
56  * activity or receiver. This corresponds to information collected
57  * from the AndroidManifest.xml's <activity> and
58  * <receiver> tags.
59  */
60 @android.ravenwood.annotation.RavenwoodKeepWholeClass
61 public class ActivityInfo extends ComponentInfo implements Parcelable {
62 
63     private static final Parcelling.BuiltIn.ForStringSet sForStringSet =
64             Parcelling.Cache.getOrCreate(Parcelling.BuiltIn.ForStringSet.class);
65 
66      // NOTE: When adding new data members be sure to update the copy-constructor, Parcel
67      // constructor, and writeToParcel.
68 
69     /**
70      * A style resource identifier (in the package's resources) of this
71      * activity's theme.  From the "theme" attribute or, if not set, 0.
72      */
73     public int theme;
74 
75     /**
76      * Constant corresponding to <code>standard</code> in
77      * the {@link android.R.attr#launchMode} attribute.
78      */
79     public static final int LAUNCH_MULTIPLE = 0;
80     /**
81      * Constant corresponding to <code>singleTop</code> in
82      * the {@link android.R.attr#launchMode} attribute.
83      */
84     public static final int LAUNCH_SINGLE_TOP = 1;
85     /**
86      * Constant corresponding to <code>singleTask</code> in
87      * the {@link android.R.attr#launchMode} attribute.
88      */
89     public static final int LAUNCH_SINGLE_TASK = 2;
90     /**
91      * Constant corresponding to <code>singleInstance</code> in
92      * the {@link android.R.attr#launchMode} attribute.
93      */
94     public static final int LAUNCH_SINGLE_INSTANCE = 3;
95     /**
96      * Constant corresponding to <code>singleInstancePerTask</code> in
97      * the {@link android.R.attr#launchMode} attribute.
98      */
99     public static final int LAUNCH_SINGLE_INSTANCE_PER_TASK = 4;
100 
101     /** @hide */
102     @IntDef(prefix = "LAUNCH_", value = {
103             LAUNCH_MULTIPLE,
104             LAUNCH_SINGLE_TOP,
105             LAUNCH_SINGLE_TASK,
106             LAUNCH_SINGLE_INSTANCE,
107             LAUNCH_SINGLE_INSTANCE_PER_TASK
108     })
109     @Retention(RetentionPolicy.SOURCE)
110     public @interface LaunchMode {
111     }
112 
113     /** @hide */
launchModeToString(@aunchMode int launchMode)114     public static String launchModeToString(@LaunchMode int launchMode) {
115         switch(launchMode) {
116             case LAUNCH_MULTIPLE:
117                 return "LAUNCH_MULTIPLE";
118             case LAUNCH_SINGLE_TOP:
119                 return "LAUNCH_SINGLE_TOP";
120             case LAUNCH_SINGLE_TASK:
121                 return "LAUNCH_SINGLE_TASK";
122             case LAUNCH_SINGLE_INSTANCE:
123                 return "LAUNCH_SINGLE_INSTANCE";
124             case LAUNCH_SINGLE_INSTANCE_PER_TASK:
125                 return "LAUNCH_SINGLE_INSTANCE_PER_TASK";
126             default:
127                 return "unknown=" + launchMode;
128         }
129     }
130 
131     /**
132      * The launch mode style requested by the activity.  From the
133      * {@link android.R.attr#launchMode} attribute.
134      */
135     @LaunchMode
136     public int launchMode;
137 
138     /**
139      * Constant corresponding to <code>none</code> in
140      * the {@link android.R.attr#documentLaunchMode} attribute.
141      */
142     public static final int DOCUMENT_LAUNCH_NONE = 0;
143     /**
144      * Constant corresponding to <code>intoExisting</code> in
145      * the {@link android.R.attr#documentLaunchMode} attribute.
146      */
147     public static final int DOCUMENT_LAUNCH_INTO_EXISTING = 1;
148     /**
149      * Constant corresponding to <code>always</code> in
150      * the {@link android.R.attr#documentLaunchMode} attribute.
151      */
152     public static final int DOCUMENT_LAUNCH_ALWAYS = 2;
153     /**
154      * Constant corresponding to <code>never</code> in
155      * the {@link android.R.attr#documentLaunchMode} attribute.
156      */
157     public static final int DOCUMENT_LAUNCH_NEVER = 3;
158     /**
159      * The document launch mode style requested by the activity. From the
160      * {@link android.R.attr#documentLaunchMode} attribute, one of
161      * {@link #DOCUMENT_LAUNCH_NONE}, {@link #DOCUMENT_LAUNCH_INTO_EXISTING},
162      * {@link #DOCUMENT_LAUNCH_ALWAYS}.
163      *
164      * <p>Modes DOCUMENT_LAUNCH_ALWAYS
165      * and DOCUMENT_LAUNCH_INTO_EXISTING are equivalent to {@link
166      * android.content.Intent#FLAG_ACTIVITY_NEW_DOCUMENT
167      * Intent.FLAG_ACTIVITY_NEW_DOCUMENT} with and without {@link
168      * android.content.Intent#FLAG_ACTIVITY_MULTIPLE_TASK
169      * Intent.FLAG_ACTIVITY_MULTIPLE_TASK} respectively.
170      */
171     public int documentLaunchMode;
172 
173     /**
174      * Constant corresponding to <code>persistRootOnly</code> in
175      * the {@link android.R.attr#persistableMode} attribute.
176      */
177     public static final int PERSIST_ROOT_ONLY = 0;
178     /**
179      * Constant corresponding to <code>doNotPersist</code> in
180      * the {@link android.R.attr#persistableMode} attribute.
181      */
182     public static final int PERSIST_NEVER = 1;
183     /**
184      * Constant corresponding to <code>persistAcrossReboots</code> in
185      * the {@link android.R.attr#persistableMode} attribute.
186      */
187     public static final int PERSIST_ACROSS_REBOOTS = 2;
188     /**
189      * Value indicating how this activity is to be persisted across
190      * reboots for restoring in the Recents list.
191      * {@link android.R.attr#persistableMode}
192      */
193     public int persistableMode;
194 
195     /**
196      * The maximum number of tasks rooted at this activity that can be in the recent task list.
197      * Refer to {@link android.R.attr#maxRecents}.
198      */
199     public int maxRecents;
200 
201     /**
202      * Optional name of a permission required to be able to access this
203      * Activity.  From the "permission" attribute.
204      */
205     public String permission;
206 
207     /**
208      * The affinity this activity has for another task in the system.  The
209      * string here is the name of the task, often the package name of the
210      * overall package.  If null, the activity has no affinity.  Set from the
211      * {@link android.R.attr#taskAffinity} attribute.
212      */
213     public String taskAffinity;
214 
215     /**
216      * If this is an activity alias, this is the real activity class to run
217      * for it.  Otherwise, this is null.
218      */
219     public String targetActivity;
220 
221     /**
222      * Token used to string together multiple events within a single launch action.
223      * @hide
224      */
225     public String launchToken;
226 
227     /**
228      * Specifies the required display category of the activity. Set from the
229      * {@link android.R.attr#requiredDisplayCategory} attribute. Upon creation, a display can
230      * specify which display categories it supports and one of the category must be present
231      * in the {@code <activity>} element to allow this activity to run. The default value is
232      * {@code null}, which indicates the activity does not have a required display category and
233      * thus can only run on a display that didn't specify any display categories. Each activity
234      * can only specify one required category but a display can support multiple display categories.
235      * <p>
236      * This field should be formatted as a Java-language-style free form string(for example,
237      * com.google.automotive_entertainment), which may contain uppercase or lowercase letters ('A'
238      * through 'Z'), numbers, and underscores ('_') but may only start with letters.
239      */
240     @Nullable
241     public String requiredDisplayCategory;
242 
243     /**
244      * Constant corresponding to {@code none} in the
245      * {@link android.R.attr#requireContentUriPermissionFromCaller} attribute.
246      * @hide
247      */
248     public static final int CONTENT_URI_PERMISSION_NONE = 0;
249 
250     /**
251      * Constant corresponding to {@code read} in the
252      * {@link android.R.attr#requireContentUriPermissionFromCaller} attribute.
253      * @hide
254      */
255     public static final int CONTENT_URI_PERMISSION_READ = 1;
256 
257     /**
258      * Constant corresponding to {@code write} in the
259      * {@link android.R.attr#requireContentUriPermissionFromCaller} attribute.
260      * @hide
261      */
262     public static final int CONTENT_URI_PERMISSION_WRITE = 2;
263 
264     /**
265      * Constant corresponding to {@code readOrWrite} in the
266      * {@link android.R.attr#requireContentUriPermissionFromCaller} attribute.
267      * @hide
268      */
269     public static final int CONTENT_URI_PERMISSION_READ_OR_WRITE = 3;
270 
271     /**
272      * Constant corresponding to {@code readAndWrite} in the
273      * {@link android.R.attr#requireContentUriPermissionFromCaller} attribute.
274      * @hide
275      */
276     public static final int CONTENT_URI_PERMISSION_READ_AND_WRITE = 4;
277 
278     /** @hide */
279     @SuppressWarnings("SwitchIntDef")
isRequiredContentUriPermissionRead( @equiredContentUriPermission int permission)280     public static boolean isRequiredContentUriPermissionRead(
281             @RequiredContentUriPermission int permission) {
282         return switch (permission) {
283             case CONTENT_URI_PERMISSION_READ_AND_WRITE, CONTENT_URI_PERMISSION_READ_OR_WRITE,
284                     CONTENT_URI_PERMISSION_READ -> true;
285             default -> false;
286         };
287     }
288 
289     /** @hide */
290     @SuppressWarnings("SwitchIntDef")
isRequiredContentUriPermissionWrite( @equiredContentUriPermission int permission)291     public static boolean isRequiredContentUriPermissionWrite(
292             @RequiredContentUriPermission int permission) {
293         return switch (permission) {
294             case CONTENT_URI_PERMISSION_READ_AND_WRITE, CONTENT_URI_PERMISSION_READ_OR_WRITE,
295                     CONTENT_URI_PERMISSION_WRITE -> true;
296             default -> false;
297         };
298     }
299 
300     /** @hide */
301     @IntDef(prefix = "CONTENT_URI_PERMISSION_", value = {
302             CONTENT_URI_PERMISSION_NONE,
303             CONTENT_URI_PERMISSION_READ,
304             CONTENT_URI_PERMISSION_WRITE,
305             CONTENT_URI_PERMISSION_READ_OR_WRITE,
306             CONTENT_URI_PERMISSION_READ_AND_WRITE
307     })
308     @Retention(RetentionPolicy.SOURCE)
309     public @interface RequiredContentUriPermission {
310     }
311 
312     private String requiredContentUriPermissionToFullString(
313             @RequiredContentUriPermission int permission) {
314         return switch (permission) {
315             case CONTENT_URI_PERMISSION_NONE -> "CONTENT_URI_PERMISSION_NONE";
316             case CONTENT_URI_PERMISSION_READ -> "CONTENT_URI_PERMISSION_READ";
317             case CONTENT_URI_PERMISSION_WRITE -> "CONTENT_URI_PERMISSION_WRITE";
318             case CONTENT_URI_PERMISSION_READ_OR_WRITE -> "CONTENT_URI_PERMISSION_READ_OR_WRITE";
319             case CONTENT_URI_PERMISSION_READ_AND_WRITE -> "CONTENT_URI_PERMISSION_READ_AND_WRITE";
320             default -> "unknown=" + permission;
321         };
322     }
323 
324     /** @hide */
325     public static String requiredContentUriPermissionToShortString(
326             @RequiredContentUriPermission int permission) {
327         return switch (permission) {
328             case CONTENT_URI_PERMISSION_NONE -> "none";
329             case CONTENT_URI_PERMISSION_READ -> "read";
330             case CONTENT_URI_PERMISSION_WRITE -> "write";
331             case CONTENT_URI_PERMISSION_READ_OR_WRITE -> "read or write";
332             case CONTENT_URI_PERMISSION_READ_AND_WRITE -> "read and write";
333             default -> "unknown=" + permission;
334         };
335     }
336 
337     /**
338      * Specifies permissions necessary to launch this activity when passing content URIs. The
339      * default value is {@code none}, meaning no specific permissions are required. Setting this
340      * attribute restricts activity invocation based on the invoker's permissions.
341      * @hide
342      */
343     @RequiredContentUriPermission
344     public int requireContentUriPermissionFromCaller;
345 
346     /**
347      * Activity can not be resized and always occupies the fullscreen area with all windows fully
348      * visible.
349      * @hide
350      */
351     public static final int RESIZE_MODE_UNRESIZEABLE = 0;
352     /**
353      * Activity didn't explicitly request to be resizeable, but we are making it resizeable because
354      * of the SDK version it targets. Only affects apps with target SDK >= N where the app is
355      * implied to be resizeable if it doesn't explicitly set the attribute to any value.
356      * @hide
357      */
358     public static final int RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION = 1;
359     /**
360      * Activity explicitly requested to be resizeable.
361      * @hide
362      */
363     @TestApi
364     public static final int RESIZE_MODE_RESIZEABLE = 2;
365     /**
366      * Activity is resizeable and supported picture-in-picture mode.  This flag is now deprecated
367      * since activities do not need to be resizeable to support picture-in-picture.
368      * See {@link #FLAG_SUPPORTS_PICTURE_IN_PICTURE}.
369      *
370      * @hide
371      * @deprecated
372      */
373     public static final int RESIZE_MODE_RESIZEABLE_AND_PIPABLE_DEPRECATED = 3;
374     /**
375      * Activity does not support resizing, but we are forcing it to be resizeable. Only affects
376      * certain pre-N apps where we force them to be resizeable.
377      * @hide
378      */
379     public static final int RESIZE_MODE_FORCE_RESIZEABLE = 4;
380     /**
381      * Activity does not support resizing, but we are forcing it to be resizeable as long
382      * as the size remains landscape.
383      * @hide
384      */
385     public static final int RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY = 5;
386     /**
387      * Activity does not support resizing, but we are forcing it to be resizeable as long
388      * as the size remains portrait.
389      * @hide
390      */
391     public static final int RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY = 6;
392     /**
393      * Activity does not support resizing, but we are forcing it to be resizeable as long
394      * as the bounds remain in the same orientation as they are.
395      * @hide
396      */
397     public static final int RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION = 7;
398     /**
399      * Value indicating if the resizing mode the activity supports.
400      * See {@link android.R.attr#resizeableActivity}.
401      * @hide
402      */
403     @UnsupportedAppUsage
404     public int resizeMode = RESIZE_MODE_RESIZEABLE;
405 
406     /**
407      * Value indicating the maximum aspect ratio the activity supports.
408      * <p>
409      * 0 means unset.
410      * @See {@link android.R.attr#maxAspectRatio}.
411      * @hide
412      */
413     private float mMaxAspectRatio;
414 
415     /**
416      * Value indicating the minimum aspect ratio the activity supports.
417      * <p>
418      * 0 means unset.
419      * @See {@link android.R.attr#minAspectRatio}.
420      * @hide
421      */
422     private float mMinAspectRatio;
423 
424     /**
425      * Indicates that the activity works well with size changes like display changing size.
426      *
427      * @hide
428      */
429     public boolean supportsSizeChanges;
430 
431     /**
432      * Name of the VrListenerService component to run for this activity.
433      * @see android.R.attr#enableVrMode
434      * @hide
435      */
436     public String requestedVrComponent;
437 
438     /**
439      * Value for {@link #colorMode} indicating that the activity should use the
440      * default color mode (sRGB, low dynamic range).
441      *
442      * @see android.R.attr#colorMode
443      */
444     public static final int COLOR_MODE_DEFAULT = 0;
445     /**
446      * Value of {@link #colorMode} indicating that the activity should use a
447      * wide color gamut if the presentation display supports it.
448      *
449      * @see android.R.attr#colorMode
450      */
451     public static final int COLOR_MODE_WIDE_COLOR_GAMUT = 1;
452     /**
453      * Value of {@link #colorMode} indicating that the activity should use a
454      * high dynamic range if the presentation display supports it.
455      *
456      * <p>Note: This does not impact SurfaceViews or SurfaceControls, as those have their own
457      * independent HDR support.</p>
458      *
459      * <p><b>Important:</b> Although this value was added in API 26, it is strongly recommended
460      * to avoid using it until API 34 which is when HDR support for the UI toolkit was officially
461      * added.</p>
462      *
463      * @see android.R.attr#colorMode
464      */
465     public static final int COLOR_MODE_HDR = 2;
466 
467     /**
468      * Comparison point against COLOR_MODE_HDR that uses 1010102
469      * Only for internal test usages
470      * @hide
471      */
472     public static final int COLOR_MODE_HDR10 = 3;
473 
474     /**
475      * Value of {@link #colorMode} indicating that the activity should use an
476      * 8 bit alpha buffer if the presentation display supports it.
477      *
478      * @see android.R.attr#colorMode
479      * @hide
480      */
481     public static final int COLOR_MODE_A8 = 4;
482 
483 
484     /** @hide */
485     @IntDef(prefix = { "COLOR_MODE_" }, value = {
486             COLOR_MODE_DEFAULT,
487             COLOR_MODE_WIDE_COLOR_GAMUT,
488             COLOR_MODE_HDR,
489             COLOR_MODE_A8,
490     })
491     @Retention(RetentionPolicy.SOURCE)
492     public @interface ColorMode {}
493 
494     /**
495      * The color mode requested by this activity. The target display may not be
496      * able to honor the request.
497      */
498     @ColorMode
499     public int colorMode = COLOR_MODE_DEFAULT;
500 
501     /**
502      * Bit in {@link #flags} indicating whether this activity is able to
503      * run in multiple processes.  If
504      * true, the system may instantiate it in the some process as the
505      * process starting it in order to conserve resources.  If false, the
506      * default, it always runs in {@link #processName}.  Set from the
507      * {@link android.R.attr#multiprocess} attribute.
508      */
509     public static final int FLAG_MULTIPROCESS = 0x0001;
510     /**
511      * Bit in {@link #flags} indicating that, when the activity's task is
512      * relaunched from home, this activity should be finished.
513      * Set from the
514      * {@link android.R.attr#finishOnTaskLaunch} attribute.
515      */
516     public static final int FLAG_FINISH_ON_TASK_LAUNCH = 0x0002;
517     /**
518      * Bit in {@link #flags} indicating that, when the activity is the root
519      * of a task, that task's stack should be cleared each time the user
520      * re-launches it from home.  As a result, the user will always
521      * return to the original activity at the top of the task.
522      * This flag only applies to activities that
523      * are used to start the root of a new task.  Set from the
524      * {@link android.R.attr#clearTaskOnLaunch} attribute.
525      */
526     public static final int FLAG_CLEAR_TASK_ON_LAUNCH = 0x0004;
527     /**
528      * Bit in {@link #flags} indicating that, when the activity is the root
529      * of a task, that task's stack should never be cleared when it is
530      * relaunched from home.  Set from the
531      * {@link android.R.attr#alwaysRetainTaskState} attribute.
532      */
533     public static final int FLAG_ALWAYS_RETAIN_TASK_STATE = 0x0008;
534     /**
535      * Bit in {@link #flags} indicating that the activity's state
536      * is not required to be saved, so that if there is a failure the
537      * activity will not be removed from the activity stack.  Set from the
538      * {@link android.R.attr#stateNotNeeded} attribute.
539      */
540     public static final int FLAG_STATE_NOT_NEEDED = 0x0010;
541     /**
542      * Bit in {@link #flags} that indicates that the activity should not
543      * appear in the list of recently launched activities.  Set from the
544      * {@link android.R.attr#excludeFromRecents} attribute.
545      */
546     public static final int FLAG_EXCLUDE_FROM_RECENTS = 0x0020;
547     /**
548      * Bit in {@link #flags} that indicates that the activity can be moved
549      * between tasks based on its task affinity.  Set from the
550      * {@link android.R.attr#allowTaskReparenting} attribute.
551      */
552     public static final int FLAG_ALLOW_TASK_REPARENTING = 0x0040;
553     /**
554      * Bit in {@link #flags} indicating that, when the user navigates away
555      * from an activity, it should be finished.
556      * Set from the
557      * {@link android.R.attr#noHistory} attribute.
558      */
559     public static final int FLAG_NO_HISTORY = 0x0080;
560     /**
561      * Bit in {@link #flags} indicating that, when a request to close system
562      * windows happens, this activity is finished.
563      * Set from the
564      * {@link android.R.attr#finishOnCloseSystemDialogs} attribute.
565      */
566     public static final int FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS = 0x0100;
567     /**
568      * Value for {@link #flags}: true when the application's rendering should
569      * be hardware accelerated.
570      */
571     public static final int FLAG_HARDWARE_ACCELERATED = 0x0200;
572     /**
573      * Value for {@link #flags}: true when the application can be displayed for all users
574      * regardless of if the user of the application is the current user. Set from the
575      * {@link android.R.attr#showForAllUsers} attribute.
576      * @hide
577      */
578     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
579     public static final int FLAG_SHOW_FOR_ALL_USERS = 0x0400;
580     /**
581      * Bit in {@link #flags} corresponding to an immersive activity
582      * that wishes not to be interrupted by notifications.
583      * Applications that hide the system notification bar with
584      * {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN}
585      * may still be interrupted by high-priority notifications; for example, an
586      * incoming phone call may use
587      * {@link android.app.Notification#fullScreenIntent fullScreenIntent}
588      * to present a full-screen in-call activity to the user, pausing the
589      * current activity as a side-effect. An activity with
590      * {@link #FLAG_IMMERSIVE} set, however, will not be interrupted; the
591      * notification may be shown in some other way (such as a small floating
592      * "toast" window).
593      *
594      * Note that this flag will always reflect the Activity's
595      * <code>android:immersive</code> manifest definition, even if the Activity's
596      * immersive state is changed at runtime via
597      * {@link android.app.Activity#setImmersive(boolean)}.
598      *
599      * @see android.app.Notification#FLAG_HIGH_PRIORITY
600      * @see android.app.Activity#setImmersive(boolean)
601      */
602     public static final int FLAG_IMMERSIVE = 0x0800;
603     /**
604      * Bit in {@link #flags}: If set, a task rooted at this activity will have its
605      * baseIntent replaced by the activity immediately above this. Each activity may further
606      * relinquish its identity to the activity above it using this flag. Set from the
607      * {@link android.R.attr#relinquishTaskIdentity} attribute.
608      */
609     public static final int FLAG_RELINQUISH_TASK_IDENTITY = 0x1000;
610     /**
611      * Bit in {@link #flags} indicating that tasks started with this activity are to be
612      * removed from the recent list of tasks when the last activity in the task is finished.
613      * Corresponds to {@link android.R.attr#autoRemoveFromRecents}
614      */
615     public static final int FLAG_AUTO_REMOVE_FROM_RECENTS = 0x2000;
616     /**
617      * Bit in {@link #flags} indicating that this activity can start is creation/resume
618      * while the previous activity is still pausing.  Corresponds to
619      * {@link android.R.attr#resumeWhilePausing}
620      */
621     public static final int FLAG_RESUME_WHILE_PAUSING = 0x4000;
622     /**
623      * Bit in {@link #flags} indicating that this activity should be run with VR mode enabled.
624      *
625      * @see android.app.Activity#setVrModeEnabled(boolean, ComponentName)
626      */
627     public static final int FLAG_ENABLE_VR_MODE = 0x8000;
628     /**
629      * Bit in {@link #flags} indicating if the activity can be displayed on a virtual display.
630      * Corresponds to {@link android.R.attr#canDisplayOnRemoteDevices}
631      * @hide
632      */
633     public static final int FLAG_CAN_DISPLAY_ON_REMOTE_DEVICES = 0x10000;
634 
635     /**
636      * Bit in {@link #flags} indicating if the activity is always focusable regardless of if it is
637      * in a task/stack whose activities are normally not focusable.
638      * See android.R.attr#alwaysFocusable.
639      * @hide
640      */
641     public static final int FLAG_ALWAYS_FOCUSABLE = 0x40000;
642 
643     /**
644      * Bit in {@link #flags} indicating if the activity is visible to instant
645      * applications. The activity is visible if it's either implicitly or
646      * explicitly exposed.
647      * @hide
648      */
649     public static final int FLAG_VISIBLE_TO_INSTANT_APP = 0x100000;
650 
651     /**
652      * Bit in {@link #flags} indicating if the activity is implicitly visible
653      * to instant applications. Implicitly visible activities are those that
654      * implement certain intent-filters:
655      * <ul>
656      * <li>action {@link Intent#CATEGORY_BROWSABLE}</li>
657      * <li>action {@link Intent#ACTION_SEND}</li>
658      * <li>action {@link Intent#ACTION_SENDTO}</li>
659      * <li>action {@link Intent#ACTION_SEND_MULTIPLE}</li>
660      * </ul>
661      * @hide
662      */
663     public static final int FLAG_IMPLICITLY_VISIBLE_TO_INSTANT_APP = 0x200000;
664 
665     /**
666      * Bit in {@link #flags} indicating if the activity supports picture-in-picture mode.
667      * See {@link android.R.attr#supportsPictureInPicture}.
668      * @hide
669      */
670     public static final int FLAG_SUPPORTS_PICTURE_IN_PICTURE = 0x400000;
671 
672     /**
673      * Bit in {@link #flags} indicating if the activity should be shown when locked.
674      * See {@link android.R.attr#showWhenLocked}
675      * @hide
676      */
677     public static final int FLAG_SHOW_WHEN_LOCKED = 0x800000;
678 
679     /**
680      * Bit in {@link #flags} indicating if the screen should turn on when starting the activity.
681      * See {@link android.R.attr#turnScreenOn}
682      * @hide
683      */
684     public static final int FLAG_TURN_SCREEN_ON = 0x1000000;
685 
686     /**
687      * Bit in {@link #flags} indicating whether the display should preferably be switched to a
688      * minimal post processing mode.
689      * See {@link android.R.attr#preferMinimalPostProcessing}
690      */
691     public static final int FLAG_PREFER_MINIMAL_POST_PROCESSING = 0x2000000;
692 
693     /**
694      * Bit in {@link #flags}: If set, indicates that the activity can be embedded by untrusted
695      * hosts. In this case the interactions with and visibility of the embedded activity may be
696      * limited. Set from the {@link android.R.attr#allowUntrustedActivityEmbedding} attribute.
697      */
698     public static final int FLAG_ALLOW_UNTRUSTED_ACTIVITY_EMBEDDING = 0x10000000;
699 
700     /**
701      * @hide Bit in {@link #flags}: If set, this component will only be seen
702      * by the system user.  Only works with broadcast receivers.  Set from the
703      * android.R.attr#systemUserOnly attribute.
704      */
705     public static final int FLAG_SYSTEM_USER_ONLY = 0x20000000;
706     /**
707      * Bit in {@link #flags}: If set, a single instance of the receiver will
708      * run for all users on the device.  Set from the
709      * {@link android.R.attr#singleUser} attribute.  Note that this flag is
710      * only relevant for ActivityInfo structures that are describing receiver
711      * components; it is not applied to activities.
712      */
713     public static final int FLAG_SINGLE_USER = 0x40000000;
714     /**
715      * @hide Bit in {@link #flags}: If set, this activity may be launched into an
716      * owned ActivityContainer such as that within an ActivityView. If not set and
717      * this activity is launched into such a container a SecurityException will be
718      * thrown. Set from the {@link android.R.attr#allowEmbedded} attribute.
719      *
720      * @deprecated this flag is no longer needed since ActivityView is now fully removed
721      * TODO(b/191165536): delete this flag since is no longer used
722      */
723     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
724     @Deprecated
725     public static final int FLAG_ALLOW_EMBEDDED = 0x80000000;
726 
727     /**
728      * Options that have been set in the activity declaration in the
729      * manifest.
730      * These include:
731      * {@link #FLAG_MULTIPROCESS},
732      * {@link #FLAG_FINISH_ON_TASK_LAUNCH}, {@link #FLAG_CLEAR_TASK_ON_LAUNCH},
733      * {@link #FLAG_ALWAYS_RETAIN_TASK_STATE},
734      * {@link #FLAG_STATE_NOT_NEEDED}, {@link #FLAG_EXCLUDE_FROM_RECENTS},
735      * {@link #FLAG_ALLOW_TASK_REPARENTING}, {@link #FLAG_NO_HISTORY},
736      * {@link #FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS},
737      * {@link #FLAG_HARDWARE_ACCELERATED}, {@link #FLAG_SINGLE_USER},
738      * {@link #FLAG_ALLOW_UNTRUSTED_ACTIVITY_EMBEDDING}.
739      */
740     public int flags;
741 
742     /**
743      * Bit in {@link #privateFlags} indicating if the activity should be shown when locked in case
744      * an activity behind this can also be shown when locked.
745      * See {@link android.R.attr#inheritShowWhenLocked}.
746      * @hide
747      */
748     public static final int FLAG_INHERIT_SHOW_WHEN_LOCKED = 1 << 0;
749 
750     /**
751      * Bit in {@link #privateFlags} indicating whether a home sound effect should be played if the
752      * home app moves to front after the activity with this flag set.
753      * Set from the {@link android.R.attr#playHomeTransitionSound} attribute.
754      * @hide
755      */
756     public static final int PRIVATE_FLAG_HOME_TRANSITION_SOUND = 1 << 1;
757 
758     /**
759      * Bit in {@link #privateFlags} indicating {@link android.view.KeyEvent#KEYCODE_BACK} related
760      * events will be replaced by a call to {@link OnBackInvokedCallback#onBackInvoked()} on the
761      * focused window.
762      * @hide
763      * @see android.R.styleable.AndroidManifestActivity_enableOnBackInvokedCallback
764      */
765     public static final int PRIVATE_FLAG_ENABLE_ON_BACK_INVOKED_CALLBACK = 1 << 2;
766 
767     /**
768      * Bit in {@link #privateFlags} indicating {@link android.view.KeyEvent#KEYCODE_BACK} related
769      * events will be forwarded to the Activity and its dialogs and views and
770      * the {@link android.app.Activity#onBackPressed()}, {@link android.app.Dialog#onBackPressed}
771      * will be called.
772      * @hide
773      * @see android.R.styleable.AndroidManifestActivity_enableOnBackInvokedCallback
774      */
775     public static final int PRIVATE_FLAG_DISABLE_ON_BACK_INVOKED_CALLBACK = 1 << 3;
776 
777     /**
778      * Options that have been set in the activity declaration in the manifest.
779      * These include:
780      * {@link #FLAG_INHERIT_SHOW_WHEN_LOCKED},
781      * {@link #PRIVATE_FLAG_HOME_TRANSITION_SOUND}.
782      * {@link #PRIVATE_FLAG_ENABLE_ON_BACK_INVOKED_CALLBACK}
783      * {@link #PRIVATE_FLAG_DISABLE_ON_BACK_INVOKED_CALLBACK}
784      * @hide
785      */
786     public int privateFlags;
787 
788     /** @hide */
789     @IntDef(prefix = { "SCREEN_ORIENTATION_" }, value = {
790             SCREEN_ORIENTATION_UNSET,
791             SCREEN_ORIENTATION_UNSPECIFIED,
792             SCREEN_ORIENTATION_LANDSCAPE,
793             SCREEN_ORIENTATION_PORTRAIT,
794             SCREEN_ORIENTATION_USER,
795             SCREEN_ORIENTATION_BEHIND,
796             SCREEN_ORIENTATION_SENSOR,
797             SCREEN_ORIENTATION_NOSENSOR,
798             SCREEN_ORIENTATION_SENSOR_LANDSCAPE,
799             SCREEN_ORIENTATION_SENSOR_PORTRAIT,
800             SCREEN_ORIENTATION_REVERSE_LANDSCAPE,
801             SCREEN_ORIENTATION_REVERSE_PORTRAIT,
802             SCREEN_ORIENTATION_FULL_SENSOR,
803             SCREEN_ORIENTATION_USER_LANDSCAPE,
804             SCREEN_ORIENTATION_USER_PORTRAIT,
805             SCREEN_ORIENTATION_FULL_USER,
806             SCREEN_ORIENTATION_LOCKED
807     })
808     @Retention(RetentionPolicy.SOURCE)
809     public @interface ScreenOrientation {}
810 
811     /**
812      * Internal constant used to indicate that the app didn't set a specific orientation value.
813      * Different from {@link #SCREEN_ORIENTATION_UNSPECIFIED} below as the app can set its
814      * orientation to {@link #SCREEN_ORIENTATION_UNSPECIFIED} while this means that the app didn't
815      * set anything. The system will mostly treat this similar to
816      * {@link #SCREEN_ORIENTATION_UNSPECIFIED}.
817      * @hide
818      */
819     public static final int SCREEN_ORIENTATION_UNSET = -2;
820     /**
821      * Constant corresponding to <code>unspecified</code> in
822      * the {@link android.R.attr#screenOrientation} attribute.
823      */
824     public static final int SCREEN_ORIENTATION_UNSPECIFIED = -1;
825     /**
826      * Constant corresponding to <code>landscape</code> in
827      * the {@link android.R.attr#screenOrientation} attribute.
828      */
829     public static final int SCREEN_ORIENTATION_LANDSCAPE = 0;
830     /**
831      * Constant corresponding to <code>portrait</code> in
832      * the {@link android.R.attr#screenOrientation} attribute.
833      */
834     public static final int SCREEN_ORIENTATION_PORTRAIT = 1;
835     /**
836      * Constant corresponding to <code>user</code> in
837      * the {@link android.R.attr#screenOrientation} attribute.
838      */
839     public static final int SCREEN_ORIENTATION_USER = 2;
840     /**
841      * Constant corresponding to <code>behind</code> in
842      * the {@link android.R.attr#screenOrientation} attribute.
843      */
844     public static final int SCREEN_ORIENTATION_BEHIND = 3;
845     /**
846      * Constant corresponding to <code>sensor</code> in
847      * the {@link android.R.attr#screenOrientation} attribute.
848      */
849     public static final int SCREEN_ORIENTATION_SENSOR = 4;
850 
851     /**
852      * Constant corresponding to <code>nosensor</code> in
853      * the {@link android.R.attr#screenOrientation} attribute.
854      */
855     public static final int SCREEN_ORIENTATION_NOSENSOR = 5;
856 
857     /**
858      * Constant corresponding to <code>sensorLandscape</code> in
859      * the {@link android.R.attr#screenOrientation} attribute.
860      */
861     public static final int SCREEN_ORIENTATION_SENSOR_LANDSCAPE = 6;
862 
863     /**
864      * Constant corresponding to <code>sensorPortrait</code> in
865      * the {@link android.R.attr#screenOrientation} attribute.
866      */
867     public static final int SCREEN_ORIENTATION_SENSOR_PORTRAIT = 7;
868 
869     /**
870      * Constant corresponding to <code>reverseLandscape</code> in
871      * the {@link android.R.attr#screenOrientation} attribute.
872      */
873     public static final int SCREEN_ORIENTATION_REVERSE_LANDSCAPE = 8;
874 
875     /**
876      * Constant corresponding to <code>reversePortrait</code> in
877      * the {@link android.R.attr#screenOrientation} attribute.
878      */
879     public static final int SCREEN_ORIENTATION_REVERSE_PORTRAIT = 9;
880 
881     /**
882      * Constant corresponding to <code>fullSensor</code> in
883      * the {@link android.R.attr#screenOrientation} attribute.
884      */
885     public static final int SCREEN_ORIENTATION_FULL_SENSOR = 10;
886 
887     /**
888      * Constant corresponding to <code>userLandscape</code> in
889      * the {@link android.R.attr#screenOrientation} attribute.
890      */
891     public static final int SCREEN_ORIENTATION_USER_LANDSCAPE = 11;
892 
893     /**
894      * Constant corresponding to <code>userPortrait</code> in
895      * the {@link android.R.attr#screenOrientation} attribute.
896      */
897     public static final int SCREEN_ORIENTATION_USER_PORTRAIT = 12;
898 
899     /**
900      * Constant corresponding to <code>fullUser</code> in
901      * the {@link android.R.attr#screenOrientation} attribute.
902      */
903     public static final int SCREEN_ORIENTATION_FULL_USER = 13;
904 
905     /**
906      * Constant corresponding to <code>locked</code> in
907      * the {@link android.R.attr#screenOrientation} attribute.
908      */
909     public static final int SCREEN_ORIENTATION_LOCKED = 14;
910 
911     /**
912      * The preferred screen orientation this activity would like to run in.
913      * From the {@link android.R.attr#screenOrientation} attribute, one of
914      * {@link #SCREEN_ORIENTATION_UNSPECIFIED},
915      * {@link #SCREEN_ORIENTATION_LANDSCAPE},
916      * {@link #SCREEN_ORIENTATION_PORTRAIT},
917      * {@link #SCREEN_ORIENTATION_USER},
918      * {@link #SCREEN_ORIENTATION_BEHIND},
919      * {@link #SCREEN_ORIENTATION_SENSOR},
920      * {@link #SCREEN_ORIENTATION_NOSENSOR},
921      * {@link #SCREEN_ORIENTATION_SENSOR_LANDSCAPE},
922      * {@link #SCREEN_ORIENTATION_SENSOR_PORTRAIT},
923      * {@link #SCREEN_ORIENTATION_REVERSE_LANDSCAPE},
924      * {@link #SCREEN_ORIENTATION_REVERSE_PORTRAIT},
925      * {@link #SCREEN_ORIENTATION_FULL_SENSOR},
926      * {@link #SCREEN_ORIENTATION_USER_LANDSCAPE},
927      * {@link #SCREEN_ORIENTATION_USER_PORTRAIT},
928      * {@link #SCREEN_ORIENTATION_FULL_USER},
929      * {@link #SCREEN_ORIENTATION_LOCKED},
930      */
931     @ScreenOrientation
932     public int screenOrientation = SCREEN_ORIENTATION_UNSPECIFIED;
933 
934     /** @hide */
935     @IntDef(flag = true, prefix = { "CONFIG_" }, value = {
936             CONFIG_MCC,
937             CONFIG_MNC,
938             CONFIG_LOCALE,
939             CONFIG_TOUCHSCREEN,
940             CONFIG_KEYBOARD,
941             CONFIG_KEYBOARD_HIDDEN,
942             CONFIG_NAVIGATION,
943             CONFIG_ORIENTATION,
944             CONFIG_SCREEN_LAYOUT,
945             CONFIG_UI_MODE,
946             CONFIG_SCREEN_SIZE,
947             CONFIG_SMALLEST_SCREEN_SIZE,
948             CONFIG_DENSITY,
949             CONFIG_LAYOUT_DIRECTION,
950             CONFIG_COLOR_MODE,
951             CONFIG_FONT_SCALE,
952             CONFIG_GRAMMATICAL_GENDER,
953             CONFIG_FONT_WEIGHT_ADJUSTMENT,
954             CONFIG_WINDOW_CONFIGURATION,
955             CONFIG_ASSETS_PATHS,
956             CONFIG_RESOURCES_UNUSED,
957     })
958     @Retention(RetentionPolicy.SOURCE)
959     public @interface Config {}
960 
961     /**
962      * Bit in {@link #configChanges} that indicates that the activity
963      * can itself handle changes to the IMSI MCC.  Set from the
964      * {@link android.R.attr#configChanges} attribute.
965      */
966     public static final int CONFIG_MCC = 0x0001;
967     /**
968      * Bit in {@link #configChanges} that indicates that the activity
969      * can itself handle changes to the IMSI MNC.  Set from the
970      * {@link android.R.attr#configChanges} attribute.
971      */
972     public static final int CONFIG_MNC = 0x0002;
973     /**
974      * Bit in {@link #configChanges} that indicates that the activity
975      * can itself handle changes to the locale.  Set from the
976      * {@link android.R.attr#configChanges} attribute.
977      */
978     public static final int CONFIG_LOCALE = 0x0004;
979     /**
980      * Bit in {@link #configChanges} that indicates that the activity
981      * can itself handle changes to the touchscreen type.  Set from the
982      * {@link android.R.attr#configChanges} attribute.
983      */
984     public static final int CONFIG_TOUCHSCREEN = 0x0008;
985     /**
986      * Bit in {@link #configChanges} that indicates that the activity
987      * can itself handle changes to the keyboard type.  Set from the
988      * {@link android.R.attr#configChanges} attribute.
989      */
990     public static final int CONFIG_KEYBOARD = 0x0010;
991     /**
992      * Bit in {@link #configChanges} that indicates that the activity
993      * can itself handle changes to the keyboard or navigation being hidden/exposed.
994      * Note that inspite of the name, this applies to the changes to any
995      * hidden states: keyboard or navigation.
996      * Set from the {@link android.R.attr#configChanges} attribute.
997      */
998     public static final int CONFIG_KEYBOARD_HIDDEN = 0x0020;
999     /**
1000      * Bit in {@link #configChanges} that indicates that the activity
1001      * can itself handle changes to the navigation type.  Set from the
1002      * {@link android.R.attr#configChanges} attribute.
1003      */
1004     public static final int CONFIG_NAVIGATION = 0x0040;
1005     /**
1006      * Bit in {@link #configChanges} that indicates that the activity
1007      * can itself handle changes to the screen orientation.  Set from the
1008      * {@link android.R.attr#configChanges} attribute.
1009      */
1010     public static final int CONFIG_ORIENTATION = 0x0080;
1011     /**
1012      * Bit in {@link #configChanges} that indicates that the activity
1013      * can itself handle changes to the screen layout.  Set from the
1014      * {@link android.R.attr#configChanges} attribute.
1015      */
1016     public static final int CONFIG_SCREEN_LAYOUT = 0x0100;
1017     /**
1018      * Bit in {@link #configChanges} that indicates that the activity
1019      * can itself handle the ui mode. Set from the
1020      * {@link android.R.attr#configChanges} attribute.
1021      */
1022     public static final int CONFIG_UI_MODE = 0x0200;
1023     /**
1024      * Bit in {@link #configChanges} that indicates that the activity
1025      * can itself handle the screen size. Set from the
1026      * {@link android.R.attr#configChanges} attribute.  This will be
1027      * set by default for applications that target an earlier version
1028      * than {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}...
1029      * <b>however</b>, you will not see the bit set here becomes some
1030      * applications incorrectly compare {@link #configChanges} against
1031      * an absolute value rather than correctly masking out the bits
1032      * they are interested in.  Please don't do that, thanks.
1033      */
1034     public static final int CONFIG_SCREEN_SIZE = 0x0400;
1035     /**
1036      * Bit in {@link #configChanges} that indicates that the activity
1037      * can itself handle the smallest screen size. Set from the
1038      * {@link android.R.attr#configChanges} attribute.  This will be
1039      * set by default for applications that target an earlier version
1040      * than {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}...
1041      * <b>however</b>, you will not see the bit set here becomes some
1042      * applications incorrectly compare {@link #configChanges} against
1043      * an absolute value rather than correctly masking out the bits
1044      * they are interested in.  Please don't do that, thanks.
1045      */
1046     public static final int CONFIG_SMALLEST_SCREEN_SIZE = 0x0800;
1047     /**
1048      * Bit in {@link #configChanges} that indicates that the activity
1049      * can itself handle density changes. Set from the
1050      * {@link android.R.attr#configChanges} attribute.
1051      */
1052     public static final int CONFIG_DENSITY = 0x1000;
1053     /**
1054      * Bit in {@link #configChanges} that indicates that the activity
1055      * can itself handle the change to layout direction. Set from the
1056      * {@link android.R.attr#configChanges} attribute.
1057      */
1058     public static final int CONFIG_LAYOUT_DIRECTION = 0x2000;
1059     /**
1060      * Bit in {@link #configChanges} that indicates that the activity
1061      * can itself handle the change to the display color gamut or dynamic
1062      * range. Set from the {@link android.R.attr#configChanges} attribute.
1063      */
1064     public static final int CONFIG_COLOR_MODE = 0x4000;
1065     /**
1066      * Bit in {@link #configChanges} that indicates that the activity
1067      * can itself handle the change to gender. Set from the
1068      * {@link android.R.attr#configChanges} attribute.
1069      */
1070     public static final int CONFIG_GRAMMATICAL_GENDER = 0x8000;
1071     /**
1072      * Bit in {@link #configChanges} that indicates that the activity
1073      * can itself handle asset path changes.  Set from the {@link android.R.attr#configChanges}
1074      * attribute. This is not a core resource configuration, but a higher-level value, so its
1075      * constant starts at the high bits.
1076      */
1077     @FlaggedApi(android.content.res.Flags.FLAG_HANDLE_ALL_CONFIG_CHANGES)
1078     public static final int CONFIG_ASSETS_PATHS = 0x80000000;
1079     /**
1080      * Bit in {@link #configChanges} that indicates that the activity
1081      * can itself handle changes to the font scaling factor.  Set from the
1082      * {@link android.R.attr#configChanges} attribute.  This is
1083      * not a core resource configuration, but a higher-level value, so its
1084      * constant starts at the high bits.
1085      */
1086     public static final int CONFIG_FONT_SCALE = 0x40000000;
1087     /**
1088      * Bit indicating changes to window configuration that isn't exposed to apps.
1089      * This is for internal use only and apps don't handle it.
1090      * @hide
1091      * {@link Configuration}.
1092      */
1093     public static final int CONFIG_WINDOW_CONFIGURATION = 0x20000000;
1094 
1095     /**
1096      * Bit in {@link #configChanges} that indicates that the activity
1097      * can itself handle changes to font weight.  Set from the
1098      * {@link android.R.attr#configChanges} attribute.  This is
1099      * not a core resource configuration, but a higher-level value, so its
1100      * constant starts at the high bits.
1101      */
1102     public static final int CONFIG_FONT_WEIGHT_ADJUSTMENT = 0x10000000;
1103 
1104     /**
1105      * <p>This is probably not the constant you want, the resources compiler supports a less
1106      * dangerous version of it, 'allKnown', that only suppresses all currently existing
1107      * configuration change restarts depending on your target SDK rather than whatever the latest
1108      * SDK supports, allowing the application to work with resources on future Platform versions.
1109      *
1110      * <p>Bit in {@link #configChanges} that indicates that the activity doesn't use Android
1111      * Resources at all and doesn't need to be restarted on any configuration changes. This bit
1112      * disables all restarts for configuration dimensions available in the current target SDK as
1113      * well as dimensions introduced in future SDKs. Use it only if the activity doesn't need
1114      * anything from its resources, and doesn't depend on any libraries that may provide resources
1115      * and need to respond to configuration changes. When set,
1116      * {@link Activity#onConfigurationChanged(Configuration)} will be called instead of a restart,
1117      * and it’s up to the implementation to ensure that no stale resource values remain loaded
1118      * anywhere in the code.
1119      *
1120      * <p>This overrides all other bits, and this is recommended to be used individually.
1121      *
1122      * <p>This is not a core resource configuration, but a higher-level value, so its constant
1123      * starts at the high bits.
1124      */
1125     @FlaggedApi(android.content.res.Flags.FLAG_HANDLE_ALL_CONFIG_CHANGES)
1126     public static final int CONFIG_RESOURCES_UNUSED = 0x8000000;
1127 
1128     /** @hide
1129      * Unfortunately the constants for config changes in native code are
1130      * different from ActivityInfo. :(  Here are the values we should use for the
1131      * native side given the bit we have assigned in ActivityInfo.
1132      */
1133     public static int[] CONFIG_NATIVE_BITS = new int[] {
1134         Configuration.NATIVE_CONFIG_MNC,                    // MNC
1135         Configuration.NATIVE_CONFIG_MCC,                    // MCC
1136         Configuration.NATIVE_CONFIG_LOCALE,                 // LOCALE
1137         Configuration.NATIVE_CONFIG_TOUCHSCREEN,            // TOUCH SCREEN
1138         Configuration.NATIVE_CONFIG_KEYBOARD,               // KEYBOARD
1139         Configuration.NATIVE_CONFIG_KEYBOARD_HIDDEN,        // KEYBOARD HIDDEN
1140         Configuration.NATIVE_CONFIG_NAVIGATION,             // NAVIGATION
1141         Configuration.NATIVE_CONFIG_ORIENTATION,            // ORIENTATION
1142         Configuration.NATIVE_CONFIG_SCREEN_LAYOUT,          // SCREEN LAYOUT
1143         Configuration.NATIVE_CONFIG_UI_MODE,                // UI MODE
1144         Configuration.NATIVE_CONFIG_SCREEN_SIZE,            // SCREEN SIZE
1145         Configuration.NATIVE_CONFIG_SMALLEST_SCREEN_SIZE,   // SMALLEST SCREEN SIZE
1146         Configuration.NATIVE_CONFIG_DENSITY,                // DENSITY
1147         Configuration.NATIVE_CONFIG_LAYOUTDIR,              // LAYOUT DIRECTION
1148         Configuration.NATIVE_CONFIG_COLOR_MODE,             // COLOR_MODE
1149         Configuration.NATIVE_CONFIG_GRAMMATICAL_GENDER,
1150     };
1151 
1152     /**
1153      * This change id forces the packages it is applied to be resizable. It won't change whether
1154      * the app can be put into multi-windowing mode, but allow the app to resize when the window
1155      * container resizes, such as display size change.
1156      * @hide
1157      */
1158     @ChangeId
1159     @Overridable
1160     @Disabled
1161     @TestApi
1162     public static final long FORCE_RESIZE_APP = 174042936L; // buganizer id
1163 
1164     /**
1165      * This change id forces the packages it is applied to to be non-resizable.
1166      * @hide
1167      */
1168     @ChangeId
1169     @Overridable
1170     @Disabled
1171     @TestApi
1172     public static final long FORCE_NON_RESIZE_APP = 181136395L; // buganizer id
1173 
1174     /**
1175      * Return value for {@link #supportsSizeChanges()} indicating that this activity does not
1176      * support size changes due to the android.supports_size_changes metadata flag either being
1177      * unset or set to {@code false} on application or activity level.
1178      *
1179      * @hide
1180      */
1181     public static final int SIZE_CHANGES_UNSUPPORTED_METADATA = 0;
1182 
1183     /**
1184      * Return value for {@link #supportsSizeChanges()} indicating that this activity has been
1185      * overridden to not support size changes through the compat framework change id
1186      * {@link #FORCE_NON_RESIZE_APP}.
1187      * @hide
1188      */
1189     public static final int SIZE_CHANGES_UNSUPPORTED_OVERRIDE = 1;
1190 
1191     /**
1192      * Return value for {@link #supportsSizeChanges()} indicating that this activity supports size
1193      * changes due to the android.supports_size_changes metadata flag being set to {@code true}
1194      * either on application or activity level.
1195      * @hide
1196      */
1197     public static final int SIZE_CHANGES_SUPPORTED_METADATA = 2;
1198 
1199     /**
1200      * Return value for {@link #supportsSizeChanges()} indicating that this activity has been
1201      * overridden to support size changes through the compat framework change id
1202      * {@link #FORCE_RESIZE_APP}.
1203      * @hide
1204      */
1205     public static final int SIZE_CHANGES_SUPPORTED_OVERRIDE = 3;
1206 
1207     /** @hide */
1208     @IntDef(prefix = { "SIZE_CHANGES_" }, value = {
1209             SIZE_CHANGES_UNSUPPORTED_METADATA,
1210             SIZE_CHANGES_UNSUPPORTED_OVERRIDE,
1211             SIZE_CHANGES_SUPPORTED_METADATA,
1212             SIZE_CHANGES_SUPPORTED_OVERRIDE,
1213     })
1214     @Retention(RetentionPolicy.SOURCE)
1215     public @interface SizeChangesSupportMode {}
1216 
1217     /**
1218      * This change id makes the restriction of fixed orientation, aspect ratio, and resizability
1219      * of the app to be ignored, which means making the app fill the given available area.
1220      * @hide
1221      */
1222     @ChangeId
1223     @Overridable
1224     @TestApi
1225     @SuppressLint("UnflaggedApi") // @TestApi without associated public API.
1226     @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.VANILLA_ICE_CREAM)
1227     public static final long UNIVERSAL_RESIZABLE_BY_DEFAULT = 357141415L; // buganizer id
1228 
1229     /**
1230      * This change id enables compat policy that ignores app requested orientation in
1231      * response to an app calling {@link android.app.Activity#setRequestedOrientation}. See
1232      * com.android.server.wm.LetterboxUiController#shouldIgnoreRequestedOrientation for
1233      * details.
1234      * @hide
1235      */
1236     @ChangeId
1237     @Overridable
1238     @Disabled
1239     @TestApi
1240     public static final long OVERRIDE_ENABLE_COMPAT_IGNORE_REQUESTED_ORIENTATION =
1241             254631730L; // buganizer id
1242 
1243     /**
1244      * This change id enables compat policy that ignores app requested orientation in
1245      * response to an app calling {@link android.app.Activity#setRequestedOrientation} more
1246      * than twice in one second if an activity is not letterboxed for fixed orientation.
1247      * See com.android.server.wm.LetterboxUiController#shouldIgnoreRequestedOrientation
1248      * for details.
1249      * @hide
1250      */
1251     @ChangeId
1252     @Overridable
1253     @Disabled
1254     @TestApi
1255     @FlaggedApi(Flags.FLAG_APP_COMPAT_PROPERTIES_API)
1256     public static final long OVERRIDE_ENABLE_COMPAT_IGNORE_ORIENTATION_REQUEST_WHEN_LOOP_DETECTED =
1257             273509367L; // buganizer id
1258 
1259     /**
1260      * This change id forces the packages it is applied to never have Display API sandboxing
1261      * applied for a letterbox or SCM activity. The Display APIs will continue to provide
1262      * DisplayArea bounds.
1263      * @hide
1264      */
1265     @ChangeId
1266     @Overridable
1267     @Disabled
1268     @TestApi
1269     public static final long NEVER_SANDBOX_DISPLAY_APIS = 184838306L; // buganizer id
1270 
1271     /**
1272      * This change id forces the packages it is applied to always have Display API sandboxing
1273      * applied, regardless of windowing mode. The Display APIs will always provide the app bounds.
1274      * @hide
1275      */
1276     @ChangeId
1277     @Overridable
1278     @Disabled
1279     @TestApi
1280     public static final long ALWAYS_SANDBOX_DISPLAY_APIS = 185004937L; // buganizer id
1281 
1282     /**
1283      * This change id excludes the packages it is applied to from ignoreOrientationRequest behaviour
1284      * that can be enabled by the device manufacturers for the com.android.server.wm.DisplayArea
1285      * or for the whole display.
1286      * @hide
1287      */
1288     @ChangeId
1289     @Overridable
1290     @Disabled
1291     public static final long OVERRIDE_RESPECT_REQUESTED_ORIENTATION = 236283604L; // buganizer id
1292 
1293     /**
1294      * This change id excludes the packages it is applied to from the camera compat force rotation
1295      * treatment. See com.android.server.wm.DisplayRotationCompatPolicy for context.
1296      * @hide
1297      */
1298     @ChangeId
1299     @Overridable
1300     @Disabled
1301     @TestApi
1302     public static final long OVERRIDE_CAMERA_COMPAT_DISABLE_FORCE_ROTATION =
1303             263959004L; // buganizer id
1304 
1305     /**
1306      * This change id excludes the packages it is applied to from activity refresh after camera
1307      * compat force rotation treatment. See com.android.server.wm.DisplayRotationCompatPolicy for
1308      * context.
1309      * @hide
1310      */
1311     @ChangeId
1312     @Overridable
1313     @Disabled
1314     @TestApi
1315     public static final long OVERRIDE_CAMERA_COMPAT_DISABLE_REFRESH = 264304459L; // buganizer id
1316 
1317     /**
1318      * This change id makes the packages it is applied to do activity refresh after camera compat
1319      * force rotation treatment using "resumed -> paused -> resumed" cycle rather than "resumed ->
1320      * ... -> stopped -> ... -> resumed" cycle. See
1321      * com.android.server.wm.DisplayRotationCompatPolicy for context.
1322      * @hide
1323      */
1324     @ChangeId
1325     @Overridable
1326     @Disabled
1327     @TestApi
1328     public static final long OVERRIDE_CAMERA_COMPAT_ENABLE_REFRESH_VIA_PAUSE =
1329             264301586L; // buganizer id
1330 
1331     /**
1332      * Includes the packages the override is applied to in the camera compatibility treatment in
1333      * free-form windowing mode for fixed-orientation apps.
1334      *
1335      * <p>In free-form windowing mode, the compatibility treatment emulates running on a portrait
1336      * device by letterboxing the app window and changing the camera characteristics to what apps
1337      * commonly expect in a portrait device: 90 and 270 degree sensor rotation for back and front
1338      * cameras, respectively, and setting display rotation to 0.
1339      *
1340      * <p>Use this flag to enable the compatibility treatment for apps in which camera doesn't work
1341      * well in freeform windowing.
1342      *
1343      * @hide
1344      */
1345     @ChangeId
1346     @Overridable
1347     @Disabled
1348     public static final long OVERRIDE_CAMERA_COMPAT_ENABLE_FREEFORM_WINDOWING_TREATMENT =
1349             314961188L;
1350 
1351     /**
1352      * Excludes the packages the override is applied to from the camera compatibility treatment for
1353      * fixed-orientation apps, which simulates running on a portrait device, in the orientation
1354      * requested by the app.
1355      *
1356      * <p>This treatment aims to mitigate camera issues on large screens, like stretched or sideways
1357      * previews. It simulates running on a portrait device by:
1358      * <ul>
1359      *   <li>Letterboxing the app window,
1360      *   <li>Cropping the camera buffer to match the app's requested orientation,
1361      *   <li>Setting the camera sensor orientation to portrait.
1362      *   <li>Setting the display rotation to match the app's requested orientation, given portrait
1363      *       natural orientation,
1364      *   <li>Refreshes the activity to trigger new camera setup, with sandboxed values.
1365      * </ul>
1366      *
1367      * <p>By setting this override to {@code true}, it disables the camera compatibility treatment
1368      * which simulates app's requested orientation.
1369      *
1370      * @hide
1371      */
1372     @ChangeId
1373     @Overridable
1374     @Disabled
1375     public static final long OVERRIDE_CAMERA_COMPAT_DISABLE_SIMULATE_REQUESTED_ORIENTATION =
1376             398195815L;  // buganizer id
1377 
1378     /**
1379      * This change id forces the packages it is applied to sandbox {@link android.view.View} API to
1380      * an activity bounds for:
1381      *
1382      * <p>{@link android.view.View#getLocationOnScreen},
1383      * {@link android.view.View#getWindowVisibleDisplayFrame},
1384      * {@link android.view.View}#getWindowDisplayFrame,
1385      * {@link android.view.View}#getBoundsOnScreen.
1386      *
1387      * <p>For {@link android.view.View#getWindowVisibleDisplayFrame} and
1388      * {@link android.view.View}#getWindowDisplayFrame this sandboxing is happening indirectly
1389      * through
1390      * {@code android.view.ViewRootImpl#getWindowVisibleDisplayFrame},
1391      * {@code android.view.ViewRootImpl#getDisplayFrame} respectively.
1392      *
1393      * <p>Some applications assume that they occupy the whole screen and therefore use the display
1394      * coordinates in their calculations as if an activity is  positioned in the top-left corner of
1395      * the screen, with left coordinate equal to 0. This may not be the case of applications in
1396      * multi-window and in letterbox modes. This can lead to shifted or out of bounds UI elements in
1397      * case the activity is Letterboxed or is in multi-window mode.
1398      * @hide
1399      */
1400     @ChangeId
1401     @Overridable
1402     @Disabled
1403     @TestApi
1404     public static final long OVERRIDE_SANDBOX_VIEW_BOUNDS_APIS = 237531167L; // buganizer id
1405 
1406     /**
1407      * This change id is the gatekeeper for all treatments that force a given min aspect ratio.
1408      * Enabling this change will allow the following min aspect ratio treatments to be applied:
1409      * <ul>
1410      *  <li>OVERRIDE_MIN_ASPECT_RATIO_SMALL
1411      *  <li>OVERRIDE_MIN_ASPECT_RATIO_MEDIUM
1412      *  <li>OVERRIDE_MIN_ASPECT_RATIO_LARGE
1413      * </ul>
1414      *
1415      * If OVERRIDE_MIN_ASPECT_RATIO is applied, the min aspect ratio given in the app's manifest
1416      * will be overridden to the largest enabled aspect ratio treatment unless the app's manifest
1417      * value is higher. By default, this will only apply to activities with fixed portrait
1418      * orientation if OVERRIDE_MIN_ASPECT_RATIO_PORTRAIT_ONLY is not explicitly disabled.
1419      * @hide
1420      */
1421     @ChangeId
1422     @Overridable
1423     @Disabled
1424     @TestApi
1425     public static final long OVERRIDE_MIN_ASPECT_RATIO = 174042980L; // buganizer id
1426 
1427     /**
1428      * This change id restricts treatments that force a given min aspect ratio to
1429      * only when an app is connected to the camera
1430      *
1431      * @hide
1432      */
1433     @ChangeId
1434     @Overridable
1435     @Disabled
1436     public static final long OVERRIDE_MIN_ASPECT_RATIO_ONLY_FOR_CAMERA = 325586858L; // buganizer id
1437 
1438     /**
1439      * This change id restricts treatments that force a given min aspect ratio to activities
1440      * whose orientation is fixed to portrait.
1441      *
1442      * This treatment is enabled by default and only takes effect if OVERRIDE_MIN_ASPECT_RATIO is
1443      * also enabled.
1444      * @hide
1445      */
1446     @ChangeId
1447     @Overridable
1448     @TestApi
1449     public static final long OVERRIDE_MIN_ASPECT_RATIO_PORTRAIT_ONLY = 203647190L; // buganizer id
1450 
1451     /**
1452      * This change id sets the activity's min aspect ratio to a small value as defined by
1453      * OVERRIDE_MIN_ASPECT_RATIO_SMALL_VALUE.
1454      *
1455      * This treatment only takes effect if OVERRIDE_MIN_ASPECT_RATIO is also enabled.
1456      * @hide
1457      */
1458     @ChangeId
1459     @Overridable
1460     @Disabled
1461     // TODO(b/349060719): Add CTS tests.
1462     public static final long OVERRIDE_MIN_ASPECT_RATIO_SMALL = 349045028L; // buganizer id
1463 
1464     /** @hide Small override aspect ratio, currently 4:3.  */
1465     public static final float OVERRIDE_MIN_ASPECT_RATIO_SMALL_VALUE = 4 / 3f;
1466 
1467     /**
1468      * This change id sets the activity's min aspect ratio to a medium value as defined by
1469      * OVERRIDE_MIN_ASPECT_RATIO_MEDIUM_VALUE.
1470      *
1471      * This treatment only takes effect if OVERRIDE_MIN_ASPECT_RATIO is also enabled.
1472      * @hide
1473      */
1474     @ChangeId
1475     @Overridable
1476     @Disabled
1477     @TestApi
1478     public static final long OVERRIDE_MIN_ASPECT_RATIO_MEDIUM = 180326845L; // buganizer id
1479 
1480     /** @hide Medium override aspect ratio, currently 3:2.  */
1481     @TestApi
1482     public static final float OVERRIDE_MIN_ASPECT_RATIO_MEDIUM_VALUE = 3 / 2f;
1483 
1484     /**
1485      * This change id sets the activity's min aspect ratio to a large value as defined by
1486      * OVERRIDE_MIN_ASPECT_RATIO_LARGE_VALUE.
1487      *
1488      * This treatment only takes effect if OVERRIDE_MIN_ASPECT_RATIO is also enabled.
1489      * @hide
1490      */
1491     @ChangeId
1492     @Overridable
1493     @Disabled
1494     @TestApi
1495     public static final long OVERRIDE_MIN_ASPECT_RATIO_LARGE = 180326787L; // buganizer id
1496 
1497     /** @hide Large override aspect ratio, currently 16:9 */
1498     @TestApi
1499     public static final float OVERRIDE_MIN_ASPECT_RATIO_LARGE_VALUE = 16 / 9f;
1500 
1501     /**
1502      * Enables the use of split screen aspect ratio. This allows an app to use all the available
1503      * space in split mode avoiding letterboxing.
1504      * @hide
1505      */
1506     @ChangeId
1507     @Disabled
1508     @Overridable
1509     @TestApi
1510     public static final long OVERRIDE_MIN_ASPECT_RATIO_TO_ALIGN_WITH_SPLIT_SCREEN = 208648326L;
1511 
1512     /**
1513      * Overrides the min aspect ratio restriction in portrait fullscreen in order to use all
1514      * available screen space.
1515      * @hide
1516      */
1517     @ChangeId
1518     @Disabled
1519     @Overridable
1520     @TestApi
1521     public static final long OVERRIDE_MIN_ASPECT_RATIO_EXCLUDE_PORTRAIT_FULLSCREEN = 218959984L;
1522 
1523     /**
1524      * Enables sending fake focus for unfocused apps in splitscreen. Some game engines
1525      * wait to get focus before drawing the content of the app so fake focus helps them to avoid
1526      * staying blacked out when they are resumed and do not have focus yet.
1527      * @hide
1528      */
1529     @ChangeId
1530     @Disabled
1531     @Overridable
1532     @TestApi
1533     public static final long OVERRIDE_ENABLE_COMPAT_FAKE_FOCUS = 263259275L;
1534 
1535     // Compat framework that per-app overrides rely on only supports booleans. That's why we have
1536     // multiple OVERRIDE_*_ORIENTATION_* change ids below instead of just one override with
1537     // the integer value.
1538 
1539     /**
1540      * Enables {@link #SCREEN_ORIENTATION_PORTRAIT}. Unless OVERRIDE_ANY_ORIENTATION
1541      * is enabled, this override is used only when no other fixed orientation was specified by the
1542      * activity.
1543      * @hide
1544      */
1545     @ChangeId
1546     @Disabled
1547     @Overridable
1548     @TestApi
1549     public static final long OVERRIDE_UNDEFINED_ORIENTATION_TO_PORTRAIT = 265452344L;
1550 
1551     /**
1552      * Enables {@link #SCREEN_ORIENTATION_NOSENSOR}. Unless OVERRIDE_ANY_ORIENTATION
1553      * is enabled, this override is used only when no other fixed orientation was specified by the
1554      * activity.
1555      * @hide
1556      */
1557     @ChangeId
1558     @Disabled
1559     @Overridable
1560     @TestApi
1561     public static final long OVERRIDE_UNDEFINED_ORIENTATION_TO_NOSENSOR = 265451093L;
1562 
1563     /**
1564      * Enables {@link #SCREEN_ORIENTATION_REVERSE_LANDSCAPE}. Unless OVERRIDE_ANY_ORIENTATION
1565      * is enabled, this override is used only when activity specify landscape orientation.
1566      * This can help apps that assume that landscape display orientation corresponds to {@link
1567      * android.view.Surface#ROTATION_90}, while on some devices it can be {@link
1568      * android.view.Surface#ROTATION_270}.
1569      * @hide
1570      */
1571     @ChangeId
1572     @Disabled
1573     @Overridable
1574     @TestApi
1575     public static final long OVERRIDE_LANDSCAPE_ORIENTATION_TO_REVERSE_LANDSCAPE = 266124927L;
1576 
1577     /**
1578      * When enabled, allows OVERRIDE_LANDSCAPE_ORIENTATION_TO_REVERSE_LANDSCAPE,
1579      * OVERRIDE_UNDEFINED_ORIENTATION_TO_NOSENSOR and OVERRIDE_UNDEFINED_ORIENTATION_TO_PORTRAIT
1580      * to override any orientation requested by the activity.
1581      * @hide
1582      */
1583     @ChangeId
1584     @Disabled
1585     @Overridable
1586     public static final long OVERRIDE_ANY_ORIENTATION = 265464455L;
1587 
1588     /**
1589      * When enabled, activates OVERRIDE_LANDSCAPE_ORIENTATION_TO_REVERSE_LANDSCAPE,
1590      * OVERRIDE_UNDEFINED_ORIENTATION_TO_NOSENSOR and OVERRIDE_UNDEFINED_ORIENTATION_TO_PORTRAIT
1591      * only when an app is connected to the camera. See
1592      * com.android.server.wm.DisplayRotationCompatPolicy for more context.
1593      * @hide
1594      */
1595     @ChangeId
1596     @Disabled
1597     @Overridable
1598     public static final long OVERRIDE_ORIENTATION_ONLY_FOR_CAMERA = 265456536L;
1599 
1600     /**
1601      * This override fixes display orientation to landscape natural orientation when a task is
1602      * fullscreen. While display rotation is fixed to landscape, the orientation requested by the
1603      * activity will be still respected by bounds resolution logic. For instance, if an activity
1604      * requests portrait orientation and this override is set, then activity will appear in the
1605      * letterbox mode for fixed orientation with the display rotated to the lanscape natural
1606      * orientation.
1607      *
1608      * <p>This override is applicable only when natural orientation of the device is
1609      * landscape and display ignores orientation requestes.
1610      *
1611      * <p>Main use case for this override are camera-using activities that are portrait-only and
1612      * assume alignment with natural device orientation. Such activities can automatically be
1613      * rotated with com.android.server.wm.DisplayRotationCompatPolicy but not all of them can
1614      * handle dynamic rotation and thus can benefit from this override.
1615      *
1616      * @hide
1617      */
1618     @ChangeId
1619     @Disabled
1620     @Overridable
1621     @TestApi
1622     public static final long OVERRIDE_USE_DISPLAY_LANDSCAPE_NATURAL_ORIENTATION = 255940284L;
1623 
1624     /**
1625      * Enables {@link #SCREEN_ORIENTATION_USER} which overrides any orientation requested
1626      * by the activity. Fixed orientation apps can be overridden to fullscreen on large
1627      * screen devices with ignoreOrientationRequest enabled with this override.
1628      *
1629      * @hide
1630      */
1631     @ChangeId
1632     @Overridable
1633     @Disabled
1634     public static final long OVERRIDE_ANY_ORIENTATION_TO_USER = 310816437L;
1635 
1636     /**
1637      * Compares activity window layout min width/height with require space for multi window to
1638      * determine if it can be put into multi window mode.
1639      */
1640     @ChangeId
1641     @EnabledSince(targetSdkVersion = Build.VERSION_CODES.S)
1642     private static final long CHECK_MIN_WIDTH_HEIGHT_FOR_MULTI_WINDOW = 197654537L;
1643 
1644     /**
1645      * The activity is targeting a SDK version that should receive the changed behavior of
1646      * configuration insets decouple.
1647      *
1648      * @hide
1649      */
1650     @ChangeId
1651     @EnabledSince(targetSdkVersion = Build.VERSION_CODES.VANILLA_ICE_CREAM)
1652     public static final long INSETS_DECOUPLED_CONFIGURATION_ENFORCED = 151861875L;
1653 
1654     /**
1655      * When enabled, the activity will receive configuration decoupled from system bar insets.
1656      *
1657      * <p>This will only apply if the activity is targeting SDK level 34 or earlier versions.
1658      *
1659      * <p>This will only in effect if the device is trying to provide a different value by default
1660      * other than the legacy value, i.e., the
1661      * {@code Flags.allowsScreenSizeDecoupledFromStatusBarAndCutout()} is set to true.
1662      *
1663      * <p>If the {@code Flags.insetsDecoupledConfiguration()} is also set to true, all apps
1664      * targeting SDK level 35 or later, and apps with this override flag will receive the insets
1665      * decoupled configuration.
1666      *
1667      * @hide
1668      */
1669     @ChangeId
1670     @Disabled
1671     @Overridable
1672     public static final long OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION = 327313645L;
1673 
1674     /**
1675      * When the override is enabled, the activity receives configuration coupled with caption bar
1676      * insets. Normally, caption bar insets are decoupled from configuration.
1677      *
1678      * <p>Override applies only if the activity targets SDK level 34 or earlier version.
1679      *
1680      * @hide
1681      */
1682     @ChangeId
1683     @Overridable
1684     @Disabled
1685     public static final long OVERRIDE_EXCLUDE_CAPTION_INSETS_FROM_APP_BOUNDS = 388014743L;
1686 
1687     /**
1688      * Optional set of a certificates identifying apps that are allowed to embed this activity. From
1689      * the "knownActivityEmbeddingCerts" attribute.
1690      */
1691     @Nullable
1692     private Set<String> mKnownActivityEmbeddingCerts;
1693 
1694     /**
1695      * Convert Java change bits to native.
1696      *
1697      * @hide
1698      */
1699     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
1700     public static @NativeConfig int activityInfoConfigJavaToNative(@Config int input) {
1701         int output = 0;
1702         for (int i = 0; i < CONFIG_NATIVE_BITS.length; i++) {
1703             if ((input & (1 << i)) != 0) {
1704                 output |= CONFIG_NATIVE_BITS[i];
1705             }
1706         }
1707         return output;
1708     }
1709 
1710     /**
1711      * Convert native change bits to Java.
1712      *
1713      * @hide
1714      */
1715     public static @Config int activityInfoConfigNativeToJava(@NativeConfig int input) {
1716         int output = 0;
1717         for (int i = 0; i < CONFIG_NATIVE_BITS.length; i++) {
1718             if ((input & CONFIG_NATIVE_BITS[i]) != 0) {
1719                 output |= (1 << i);
1720             }
1721         }
1722         return output;
1723     }
1724 
1725     /**
1726      * @hide
1727      * Unfortunately some developers (OpenFeint I am looking at you) have
1728      * compared the configChanges bit field against absolute values, so if we
1729      * introduce a new bit they break.  To deal with that, we will make sure
1730      * the public field will not have a value that breaks them, and let the
1731      * framework call here to get the real value.
1732      */
1733     public int getRealConfigChanged() {
1734         return applicationInfo.targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB_MR2
1735                 ? (configChanges | ActivityInfo.CONFIG_SCREEN_SIZE
1736                         | ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE)
1737                 : configChanges;
1738     }
1739 
1740     /**
1741      * Bit mask of kinds of configuration changes that this activity
1742      * can handle itself (without being restarted by the system).
1743      * Contains any combination of {@link #CONFIG_FONT_SCALE},
1744      * {@link #CONFIG_MCC}, {@link #CONFIG_MNC},
1745      * {@link #CONFIG_LOCALE}, {@link #CONFIG_TOUCHSCREEN},
1746      * {@link #CONFIG_KEYBOARD}, {@link #CONFIG_NAVIGATION},
1747      * {@link #CONFIG_ORIENTATION}, {@link #CONFIG_SCREEN_LAYOUT},
1748      * {@link #CONFIG_DENSITY}, {@link #CONFIG_LAYOUT_DIRECTION},
1749      * {@link #CONFIG_COLOR_MODE}, {@link #CONFIG_GRAMMATICAL_GENDER},
1750      * {@link #CONFIG_ASSETS_PATHS}, and {@link #CONFIG_RESOURCES_UNUSED}.
1751      * Set from the {@link android.R.attr#configChanges} attribute.
1752      */
1753     public int configChanges;
1754 
1755     /**
1756      * The desired soft input mode for this activity's main window.
1757      * Set from the {@link android.R.attr#windowSoftInputMode} attribute
1758      * in the activity's manifest.  May be any of the same values allowed
1759      * for {@link android.view.WindowManager.LayoutParams#softInputMode
1760      * WindowManager.LayoutParams.softInputMode}.  If 0 (unspecified),
1761      * the mode from the theme will be used.
1762      */
1763     @android.view.WindowManager.LayoutParams.SoftInputModeFlags
1764     public int softInputMode;
1765 
1766     /**
1767      * The desired extra UI options for this activity and its main window.
1768      * Set from the {@link android.R.attr#uiOptions} attribute in the
1769      * activity's manifest.
1770      */
1771     public int uiOptions = 0;
1772 
1773     /**
1774      * Flag for use with {@link #uiOptions}.
1775      * Indicates that the action bar should put all action items in a separate bar when
1776      * the screen is narrow.
1777      * <p>This value corresponds to "splitActionBarWhenNarrow" for the {@link #uiOptions} XML
1778      * attribute.
1779      */
1780     public static final int UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW = 1;
1781 
1782     /**
1783      * If defined, the activity named here is the logical parent of this activity.
1784      */
1785     public String parentActivityName;
1786 
1787     /**
1788      * Screen rotation animation desired by the activity, with values as defined
1789      * for {@link android.view.WindowManager.LayoutParams#rotationAnimation}.
1790      *
1791      * -1 means to use the system default.
1792      *
1793      * @hide
1794      */
1795     public int rotationAnimation = -1;
1796 
1797     /** @hide */
1798     public static final int LOCK_TASK_LAUNCH_MODE_DEFAULT = 0;
1799     /** @hide */
1800     public static final int LOCK_TASK_LAUNCH_MODE_NEVER = 1;
1801     /** @hide */
1802     public static final int LOCK_TASK_LAUNCH_MODE_ALWAYS = 2;
1803     /** @hide */
1804     public static final int LOCK_TASK_LAUNCH_MODE_IF_ALLOWLISTED = 3;
1805 
1806     /** @hide */
1807     public static final String lockTaskLaunchModeToString(int lockTaskLaunchMode) {
1808         switch (lockTaskLaunchMode) {
1809             case LOCK_TASK_LAUNCH_MODE_DEFAULT:
1810                 return "LOCK_TASK_LAUNCH_MODE_DEFAULT";
1811             case LOCK_TASK_LAUNCH_MODE_NEVER:
1812                 return "LOCK_TASK_LAUNCH_MODE_NEVER";
1813             case LOCK_TASK_LAUNCH_MODE_ALWAYS:
1814                 return "LOCK_TASK_LAUNCH_MODE_ALWAYS";
1815             case LOCK_TASK_LAUNCH_MODE_IF_ALLOWLISTED:
1816                 return "LOCK_TASK_LAUNCH_MODE_IF_ALLOWLISTED";
1817             default:
1818                 return "unknown=" + lockTaskLaunchMode;
1819         }
1820     }
1821     /**
1822      * Value indicating if the activity is to be locked at startup. Takes on the values from
1823      * {@link android.R.attr#lockTaskMode}.
1824      * @hide
1825      */
1826     public int lockTaskLaunchMode;
1827 
1828     /**
1829      * Information about desired position and size of activity on the display when
1830      * it is first started.
1831      */
1832     public WindowLayout windowLayout;
1833 
1834     public ActivityInfo() {
1835     }
1836 
1837     public ActivityInfo(ActivityInfo orig) {
1838         super(orig);
1839         theme = orig.theme;
1840         launchMode = orig.launchMode;
1841         documentLaunchMode = orig.documentLaunchMode;
1842         permission = orig.permission;
1843         mKnownActivityEmbeddingCerts = orig.mKnownActivityEmbeddingCerts;
1844         taskAffinity = orig.taskAffinity;
1845         targetActivity = orig.targetActivity;
1846         flags = orig.flags;
1847         privateFlags = orig.privateFlags;
1848         screenOrientation = orig.screenOrientation;
1849         configChanges = orig.configChanges;
1850         softInputMode = orig.softInputMode;
1851         uiOptions = orig.uiOptions;
1852         parentActivityName = orig.parentActivityName;
1853         maxRecents = orig.maxRecents;
1854         lockTaskLaunchMode = orig.lockTaskLaunchMode;
1855         windowLayout = orig.windowLayout;
1856         resizeMode = orig.resizeMode;
1857         requestedVrComponent = orig.requestedVrComponent;
1858         rotationAnimation = orig.rotationAnimation;
1859         colorMode = orig.colorMode;
1860         mMaxAspectRatio = orig.mMaxAspectRatio;
1861         mMinAspectRatio = orig.mMinAspectRatio;
1862         supportsSizeChanges = orig.supportsSizeChanges;
1863         requiredDisplayCategory = orig.requiredDisplayCategory;
1864         requireContentUriPermissionFromCaller = orig.requireContentUriPermissionFromCaller;
1865     }
1866 
1867     /**
1868      * Return the theme resource identifier to use for this activity.  If
1869      * the activity defines a theme, that is used; else, the application
1870      * theme is used.
1871      *
1872      * @return The theme associated with this activity.
1873      */
1874     public final int getThemeResource() {
1875         return theme != 0 ? theme : applicationInfo.theme;
1876     }
1877 
1878     private String persistableModeToString() {
1879         switch(persistableMode) {
1880             case PERSIST_ROOT_ONLY: return "PERSIST_ROOT_ONLY";
1881             case PERSIST_NEVER: return "PERSIST_NEVER";
1882             case PERSIST_ACROSS_REBOOTS: return "PERSIST_ACROSS_REBOOTS";
1883             default: return "UNKNOWN=" + persistableMode;
1884         }
1885     }
1886 
1887     /**
1888      * Returns true if the activity has maximum or minimum aspect ratio.
1889      * @hide
1890      */
1891     public boolean hasFixedAspectRatio() {
1892         return getMaxAspectRatio() != 0 || getMinAspectRatio() != 0;
1893     }
1894 
1895     /**
1896      * Returns true if the activity's orientation is fixed.
1897      * @hide
1898      */
1899     public boolean isFixedOrientation() {
1900         return isFixedOrientation(screenOrientation);
1901     }
1902 
1903     /**
1904      * Returns true if the passed activity's orientation is fixed.
1905      * @hide
1906      */
1907     public static boolean isFixedOrientation(@ScreenOrientation int orientation) {
1908         return orientation == SCREEN_ORIENTATION_LOCKED
1909                 // Orientation is fixed to natural display orientation
1910                 || orientation == SCREEN_ORIENTATION_NOSENSOR
1911                 || isFixedOrientationLandscape(orientation)
1912                 || isFixedOrientationPortrait(orientation);
1913     }
1914 
1915     /**
1916      * Returns true if the activity's orientation is fixed to landscape.
1917      * @hide
1918      */
1919     boolean isFixedOrientationLandscape() {
1920         return isFixedOrientationLandscape(screenOrientation);
1921     }
1922 
1923     /**
1924      * Returns true if the activity's orientation is fixed to landscape.
1925      * @hide
1926      */
1927     public static boolean isFixedOrientationLandscape(@ScreenOrientation int orientation) {
1928         return orientation == SCREEN_ORIENTATION_LANDSCAPE
1929                 || orientation == SCREEN_ORIENTATION_SENSOR_LANDSCAPE
1930                 || orientation == SCREEN_ORIENTATION_REVERSE_LANDSCAPE
1931                 || orientation == SCREEN_ORIENTATION_USER_LANDSCAPE;
1932     }
1933 
1934     /**
1935      * Returns true if the activity's orientation is fixed to portrait.
1936      * @hide
1937      */
1938     boolean isFixedOrientationPortrait() {
1939         return isFixedOrientationPortrait(screenOrientation);
1940     }
1941 
1942     /**
1943      * Returns true if the activity's orientation is fixed to portrait.
1944      * @hide
1945      */
1946     public static boolean isFixedOrientationPortrait(@ScreenOrientation int orientation) {
1947         return orientation == SCREEN_ORIENTATION_PORTRAIT
1948                 || orientation == SCREEN_ORIENTATION_SENSOR_PORTRAIT
1949                 || orientation == SCREEN_ORIENTATION_REVERSE_PORTRAIT
1950                 || orientation == SCREEN_ORIENTATION_USER_PORTRAIT;
1951     }
1952 
1953     /**
1954      * Returns the reversed orientation.
1955      * @hide
1956      */
1957     @ActivityInfo.ScreenOrientation
1958     public static int reverseOrientation(@ActivityInfo.ScreenOrientation int orientation) {
1959         switch (orientation) {
1960             case SCREEN_ORIENTATION_LANDSCAPE:
1961                 return SCREEN_ORIENTATION_PORTRAIT;
1962             case SCREEN_ORIENTATION_PORTRAIT:
1963                 return SCREEN_ORIENTATION_LANDSCAPE;
1964             case SCREEN_ORIENTATION_SENSOR_LANDSCAPE:
1965                 return SCREEN_ORIENTATION_SENSOR_PORTRAIT;
1966             case SCREEN_ORIENTATION_SENSOR_PORTRAIT:
1967                 return SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
1968             case SCREEN_ORIENTATION_REVERSE_LANDSCAPE:
1969                 return SCREEN_ORIENTATION_REVERSE_PORTRAIT;
1970             case SCREEN_ORIENTATION_REVERSE_PORTRAIT:
1971                 return SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
1972             case SCREEN_ORIENTATION_USER_LANDSCAPE:
1973                 return SCREEN_ORIENTATION_USER_PORTRAIT;
1974             case SCREEN_ORIENTATION_USER_PORTRAIT:
1975                 return SCREEN_ORIENTATION_USER_LANDSCAPE;
1976             default:
1977                 return orientation;
1978         }
1979     }
1980 
1981     /**
1982      * Returns true if the activity supports picture-in-picture.
1983      * @hide
1984      */
1985     @UnsupportedAppUsage
1986     public boolean supportsPictureInPicture() {
1987         return (flags & FLAG_SUPPORTS_PICTURE_IN_PICTURE) != 0;
1988     }
1989 
1990     /**
1991      * Returns if the activity should never be sandboxed to the activity window bounds.
1992      * @hide
1993      */
1994     public boolean neverSandboxDisplayApis(ConstrainDisplayApisConfig constrainDisplayApisConfig) {
1995         return isChangeEnabled(NEVER_SANDBOX_DISPLAY_APIS)
1996                 || constrainDisplayApisConfig.getNeverConstrainDisplayApis(applicationInfo);
1997     }
1998 
1999     /**
2000      * Returns if the activity should always be sandboxed to the activity window bounds.
2001      * @hide
2002      */
2003     public boolean alwaysSandboxDisplayApis(ConstrainDisplayApisConfig constrainDisplayApisConfig) {
2004         return isChangeEnabled(ALWAYS_SANDBOX_DISPLAY_APIS)
2005                 || constrainDisplayApisConfig.getAlwaysConstrainDisplayApis(applicationInfo);
2006     }
2007 
2008     /** @hide */
2009     public void setMaxAspectRatio(@FloatRange(from = 0f) float maxAspectRatio) {
2010         this.mMaxAspectRatio = maxAspectRatio >= 0f ? maxAspectRatio : 0f;
2011     }
2012 
2013     /** @hide */
2014     public float getMaxAspectRatio() {
2015         return mMaxAspectRatio;
2016     }
2017 
2018     /** @hide */
2019     public void setMinAspectRatio(@FloatRange(from = 0f) float minAspectRatio) {
2020         this.mMinAspectRatio = minAspectRatio >= 0f ? minAspectRatio : 0f;
2021     }
2022 
2023     /**
2024      * Returns the min aspect ratio of this activity as defined in the manifest file.
2025      * @hide
2026      */
2027     public float getMinAspectRatio() {
2028         return mMinAspectRatio;
2029     }
2030 
2031     /**
2032      * Gets the trusted host certificate digests of apps that are allowed to embed this activity.
2033      * The digests are computed using the SHA-256 digest algorithm.
2034      * @see android.R.attr#knownActivityEmbeddingCerts
2035      */
2036     @NonNull
2037     public Set<String> getKnownActivityEmbeddingCerts() {
2038         return mKnownActivityEmbeddingCerts == null ? Collections.emptySet()
2039                 : mKnownActivityEmbeddingCerts;
2040     }
2041 
2042     /**
2043      * Sets the trusted host certificates of apps that are allowed to embed this activity.
2044      * @see #getKnownActivityEmbeddingCerts()
2045      * @hide
2046      */
2047     public void setKnownActivityEmbeddingCerts(@NonNull Set<String> knownActivityEmbeddingCerts) {
2048         // Convert the provided digest to upper case for consistent Set membership
2049         // checks when verifying the signing certificate digests of requesting apps.
2050         mKnownActivityEmbeddingCerts = new ArraySet<>();
2051         for (String knownCert : knownActivityEmbeddingCerts) {
2052             mKnownActivityEmbeddingCerts.add(knownCert.toUpperCase(Locale.US));
2053         }
2054     }
2055 
2056     /**
2057      * Checks if a changeId is enabled for the current user
2058      * @param changeId The changeId to verify
2059      * @return True of the changeId is enabled
2060      * @hide
2061      */
2062     public boolean isChangeEnabled(long changeId) {
2063         return applicationInfo.isChangeEnabled(changeId);
2064     }
2065 
2066     /** @hide */
2067     public float getManifestMinAspectRatio() {
2068         return mMinAspectRatio;
2069     }
2070 
2071     /** @hide */
2072     @UnsupportedAppUsage
2073     public static boolean isResizeableMode(int mode) {
2074         return mode == RESIZE_MODE_RESIZEABLE
2075                 || mode == RESIZE_MODE_FORCE_RESIZEABLE
2076                 || mode == RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY
2077                 || mode == RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY
2078                 || mode == RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION
2079                 || mode == RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION;
2080     }
2081 
2082     /** @hide */
2083     public static boolean isPreserveOrientationMode(int mode) {
2084         return mode == RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY
2085                 || mode == RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY
2086                 || mode == RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION;
2087     }
2088 
2089     /** @hide */
2090     public static String resizeModeToString(int mode) {
2091         switch (mode) {
2092             case RESIZE_MODE_UNRESIZEABLE:
2093                 return "RESIZE_MODE_UNRESIZEABLE";
2094             case RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION:
2095                 return "RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION";
2096             case RESIZE_MODE_RESIZEABLE:
2097                 return "RESIZE_MODE_RESIZEABLE";
2098             case RESIZE_MODE_FORCE_RESIZEABLE:
2099                 return "RESIZE_MODE_FORCE_RESIZEABLE";
2100             case RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY:
2101                 return "RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY";
2102             case RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY:
2103                 return "RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY";
2104             case RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION:
2105                 return "RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION";
2106             default:
2107                 return "unknown=" + mode;
2108         }
2109     }
2110 
2111     /** @hide */
2112     public static String sizeChangesSupportModeToString(@SizeChangesSupportMode int mode) {
2113         switch (mode) {
2114             case SIZE_CHANGES_UNSUPPORTED_METADATA:
2115                 return "SIZE_CHANGES_UNSUPPORTED_METADATA";
2116             case SIZE_CHANGES_UNSUPPORTED_OVERRIDE:
2117                 return "SIZE_CHANGES_UNSUPPORTED_OVERRIDE";
2118             case SIZE_CHANGES_SUPPORTED_METADATA:
2119                 return "SIZE_CHANGES_SUPPORTED_METADATA";
2120             case SIZE_CHANGES_SUPPORTED_OVERRIDE:
2121                 return "SIZE_CHANGES_SUPPORTED_OVERRIDE";
2122             default:
2123                 return "unknown=" + mode;
2124         }
2125     }
2126 
2127     /**
2128      * Whether we should compare activity window layout min width/height with require space for
2129      * multi window to determine if it can be put into multi window mode.
2130      * @hide
2131      */
2132     public boolean shouldCheckMinWidthHeightForMultiWindow() {
2133         return isChangeEnabled(CHECK_MIN_WIDTH_HEIGHT_FOR_MULTI_WINDOW);
2134     }
2135 
2136     /**
2137      * Returns whether the activity will set the
2138      * {@link R.styleable.AndroidManifestActivity_enableOnBackInvokedCallback} attribute.
2139      *
2140      * @hide
2141      */
2142     public boolean hasOnBackInvokedCallbackEnabled() {
2143         return (privateFlags & (PRIVATE_FLAG_ENABLE_ON_BACK_INVOKED_CALLBACK
2144                 | PRIVATE_FLAG_DISABLE_ON_BACK_INVOKED_CALLBACK)) != 0;
2145     }
2146 
2147     /**
2148      * Returns whether the activity will use the {@link android.window.OnBackInvokedCallback}
2149      * navigation system instead of the {@link android.view.KeyEvent#KEYCODE_BACK} and related
2150      * callbacks.
2151      *
2152      * Valid when the {@link R.styleable.AndroidManifestActivity_enableOnBackInvokedCallback}
2153      * attribute has been set, or it won't indicate if the activity should use the
2154      * navigation system and the {@link hasOnBackInvokedCallbackEnabled} will return false.
2155      * @hide
2156      */
2157     public boolean isOnBackInvokedCallbackEnabled() {
2158         return hasOnBackInvokedCallbackEnabled()
2159                 && (privateFlags & PRIVATE_FLAG_ENABLE_ON_BACK_INVOKED_CALLBACK) != 0;
2160     }
2161 
2162     public void dump(Printer pw, String prefix) {
2163         dump(pw, prefix, DUMP_FLAG_ALL);
2164     }
2165 
2166     /** @hide */
2167     public void dump(Printer pw, String prefix, int dumpFlags) {
2168         super.dumpFront(pw, prefix);
2169         if (permission != null) {
2170             pw.println(prefix + "permission=" + permission);
2171         }
2172         if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
2173             pw.println(prefix + "taskAffinity=" + taskAffinity
2174                     + " targetActivity=" + targetActivity
2175                     + " persistableMode=" + persistableModeToString());
2176         }
2177         if (launchMode != 0 || flags != 0 || privateFlags != 0 || theme != 0) {
2178             pw.println(prefix + "launchMode=" + launchModeToString(launchMode)
2179                     + " flags=0x" + Integer.toHexString(flags)
2180                     + " privateFlags=0x" + Integer.toHexString(privateFlags)
2181                     + " theme=0x" + Integer.toHexString(theme));
2182         }
2183         if (screenOrientation != SCREEN_ORIENTATION_UNSPECIFIED
2184                 || configChanges != 0 || softInputMode != 0) {
2185             pw.println(prefix + "screenOrientation=" + screenOrientation
2186                     + " configChanges=0x" + Integer.toHexString(configChanges)
2187                     + " softInputMode=0x" + Integer.toHexString(softInputMode));
2188         }
2189         if (uiOptions != 0) {
2190             pw.println(prefix + " uiOptions=0x" + Integer.toHexString(uiOptions));
2191         }
2192         if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
2193             pw.println(prefix + "lockTaskLaunchMode="
2194                     + lockTaskLaunchModeToString(lockTaskLaunchMode));
2195         }
2196         if (windowLayout != null) {
2197             pw.println(prefix + "windowLayout=" + windowLayout.width + "|"
2198                     + windowLayout.widthFraction + ", " + windowLayout.height + "|"
2199                     + windowLayout.heightFraction + ", " + windowLayout.gravity);
2200         }
2201         pw.println(prefix + "resizeMode=" + resizeModeToString(resizeMode));
2202         if (requestedVrComponent != null) {
2203             pw.println(prefix + "requestedVrComponent=" + requestedVrComponent);
2204         }
2205         if (getMaxAspectRatio() != 0) {
2206             pw.println(prefix + "maxAspectRatio=" + getMaxAspectRatio());
2207         }
2208         final float minAspectRatio = getMinAspectRatio();
2209         if (minAspectRatio != 0) {
2210             pw.println(prefix + "minAspectRatio=" + minAspectRatio);
2211         }
2212         if (supportsSizeChanges) {
2213             pw.println(prefix + "supportsSizeChanges=true");
2214         }
2215         if (mKnownActivityEmbeddingCerts != null) {
2216             pw.println(prefix + "knownActivityEmbeddingCerts=" + mKnownActivityEmbeddingCerts);
2217         }
2218         if (requiredDisplayCategory != null) {
2219             pw.println(prefix + "requiredDisplayCategory=" + requiredDisplayCategory);
2220         }
2221         if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
2222             pw.println(prefix + "requireContentUriPermissionFromCaller="
2223                     + requiredContentUriPermissionToFullString(
2224                             requireContentUriPermissionFromCaller));
2225         }
2226         super.dumpBack(pw, prefix, dumpFlags);
2227     }
2228 
2229     public String toString() {
2230         return "ActivityInfo{"
2231             + Integer.toHexString(System.identityHashCode(this))
2232             + " " + name + "}";
2233     }
2234 
2235     public int describeContents() {
2236         return 0;
2237     }
2238 
2239     public void writeToParcel(Parcel dest, int parcelableFlags) {
2240         super.writeToParcel(dest, parcelableFlags);
2241         dest.writeInt(theme);
2242         dest.writeInt(launchMode);
2243         dest.writeInt(documentLaunchMode);
2244         dest.writeString8(permission);
2245         dest.writeString8(taskAffinity);
2246         dest.writeString8(targetActivity);
2247         dest.writeString8(launchToken);
2248         dest.writeInt(flags);
2249         dest.writeInt(privateFlags);
2250         dest.writeInt(screenOrientation);
2251         dest.writeInt(configChanges);
2252         dest.writeInt(softInputMode);
2253         dest.writeInt(uiOptions);
2254         dest.writeString8(parentActivityName);
2255         dest.writeInt(persistableMode);
2256         dest.writeInt(maxRecents);
2257         dest.writeInt(lockTaskLaunchMode);
2258         if (windowLayout != null) {
2259             dest.writeInt(1);
2260             windowLayout.writeToParcel(dest);
2261         } else {
2262             dest.writeInt(0);
2263         }
2264         dest.writeInt(resizeMode);
2265         dest.writeString8(requestedVrComponent);
2266         dest.writeInt(rotationAnimation);
2267         dest.writeInt(colorMode);
2268         dest.writeFloat(mMaxAspectRatio);
2269         dest.writeFloat(mMinAspectRatio);
2270         dest.writeBoolean(supportsSizeChanges);
2271         sForStringSet.parcel(mKnownActivityEmbeddingCerts, dest, flags);
2272         dest.writeString8(requiredDisplayCategory);
2273         dest.writeInt(requireContentUriPermissionFromCaller);
2274     }
2275 
2276     /**
2277      * Determines whether the {@link Activity} is considered translucent or floating.
2278      * @hide
2279      */
2280     @UnsupportedAppUsage
2281     @TestApi
2282     public static boolean isTranslucentOrFloating(TypedArray attributes) {
2283         final boolean isTranslucent =
2284                 attributes.getBoolean(com.android.internal.R.styleable.Window_windowIsTranslucent,
2285                         false);
2286         final boolean isFloating =
2287                 attributes.getBoolean(com.android.internal.R.styleable.Window_windowIsFloating,
2288                         false);
2289 
2290         return isFloating || isTranslucent;
2291     }
2292 
2293     /**
2294      * Convert the screen orientation constant to a human readable format.
2295      * @hide
2296      */
2297     public static String screenOrientationToString(int orientation) {
2298         switch (orientation) {
2299             case SCREEN_ORIENTATION_UNSET:
2300                 return "SCREEN_ORIENTATION_UNSET";
2301             case SCREEN_ORIENTATION_UNSPECIFIED:
2302                 return "SCREEN_ORIENTATION_UNSPECIFIED";
2303             case SCREEN_ORIENTATION_LANDSCAPE:
2304                 return "SCREEN_ORIENTATION_LANDSCAPE";
2305             case SCREEN_ORIENTATION_PORTRAIT:
2306                 return "SCREEN_ORIENTATION_PORTRAIT";
2307             case SCREEN_ORIENTATION_USER:
2308                 return "SCREEN_ORIENTATION_USER";
2309             case SCREEN_ORIENTATION_BEHIND:
2310                 return "SCREEN_ORIENTATION_BEHIND";
2311             case SCREEN_ORIENTATION_SENSOR:
2312                 return "SCREEN_ORIENTATION_SENSOR";
2313             case SCREEN_ORIENTATION_NOSENSOR:
2314                 return "SCREEN_ORIENTATION_NOSENSOR";
2315             case SCREEN_ORIENTATION_SENSOR_LANDSCAPE:
2316                 return "SCREEN_ORIENTATION_SENSOR_LANDSCAPE";
2317             case SCREEN_ORIENTATION_SENSOR_PORTRAIT:
2318                 return "SCREEN_ORIENTATION_SENSOR_PORTRAIT";
2319             case SCREEN_ORIENTATION_REVERSE_LANDSCAPE:
2320                 return "SCREEN_ORIENTATION_REVERSE_LANDSCAPE";
2321             case SCREEN_ORIENTATION_REVERSE_PORTRAIT:
2322                 return "SCREEN_ORIENTATION_REVERSE_PORTRAIT";
2323             case SCREEN_ORIENTATION_FULL_SENSOR:
2324                 return "SCREEN_ORIENTATION_FULL_SENSOR";
2325             case SCREEN_ORIENTATION_USER_LANDSCAPE:
2326                 return "SCREEN_ORIENTATION_USER_LANDSCAPE";
2327             case SCREEN_ORIENTATION_USER_PORTRAIT:
2328                 return "SCREEN_ORIENTATION_USER_PORTRAIT";
2329             case SCREEN_ORIENTATION_FULL_USER:
2330                 return "SCREEN_ORIENTATION_FULL_USER";
2331             case SCREEN_ORIENTATION_LOCKED:
2332                 return "SCREEN_ORIENTATION_LOCKED";
2333             default:
2334                 return Integer.toString(orientation);
2335         }
2336     }
2337 
2338     /**
2339      * @hide
2340      */
2341     public static String colorModeToString(@ColorMode int colorMode) {
2342         switch (colorMode) {
2343             case COLOR_MODE_DEFAULT:
2344                 return "COLOR_MODE_DEFAULT";
2345             case COLOR_MODE_WIDE_COLOR_GAMUT:
2346                 return "COLOR_MODE_WIDE_COLOR_GAMUT";
2347             case COLOR_MODE_HDR:
2348                 return "COLOR_MODE_HDR";
2349             case COLOR_MODE_A8:
2350                 return "COLOR_MODE_A8";
2351             default:
2352                 return Integer.toString(colorMode);
2353         }
2354     }
2355 
2356     public static final @android.annotation.NonNull Parcelable.Creator<ActivityInfo> CREATOR
2357             = new Parcelable.Creator<ActivityInfo>() {
2358         public ActivityInfo createFromParcel(Parcel source) {
2359             return new ActivityInfo(source);
2360         }
2361         public ActivityInfo[] newArray(int size) {
2362             return new ActivityInfo[size];
2363         }
2364     };
2365 
2366     private ActivityInfo(Parcel source) {
2367         super(source);
2368         theme = source.readInt();
2369         launchMode = source.readInt();
2370         documentLaunchMode = source.readInt();
2371         permission = source.readString8();
2372         taskAffinity = source.readString8();
2373         targetActivity = source.readString8();
2374         launchToken = source.readString8();
2375         flags = source.readInt();
2376         privateFlags = source.readInt();
2377         screenOrientation = source.readInt();
2378         configChanges = source.readInt();
2379         softInputMode = source.readInt();
2380         uiOptions = source.readInt();
2381         parentActivityName = source.readString8();
2382         persistableMode = source.readInt();
2383         maxRecents = source.readInt();
2384         lockTaskLaunchMode = source.readInt();
2385         if (source.readInt() == 1) {
2386             windowLayout = new WindowLayout(source);
2387         }
2388         resizeMode = source.readInt();
2389         requestedVrComponent = source.readString8();
2390         rotationAnimation = source.readInt();
2391         colorMode = source.readInt();
2392         mMaxAspectRatio = source.readFloat();
2393         mMinAspectRatio = source.readFloat();
2394         supportsSizeChanges = source.readBoolean();
2395         mKnownActivityEmbeddingCerts = sForStringSet.unparcel(source);
2396         if (mKnownActivityEmbeddingCerts.isEmpty()) {
2397             mKnownActivityEmbeddingCerts = null;
2398         }
2399         requiredDisplayCategory = source.readString8();
2400         requireContentUriPermissionFromCaller = source.readInt();
2401     }
2402 
2403     /**
2404      * Contains information about position and size of the activity on the display.
2405      *
2406      * Used in freeform mode to set desired position when activity is first launched.
2407      * It describes how big the activity wants to be in both width and height,
2408      * the minimal allowed size, and the gravity to be applied.
2409      *
2410      * @attr ref android.R.styleable#AndroidManifestLayout_defaultWidth
2411      * @attr ref android.R.styleable#AndroidManifestLayout_defaultHeight
2412      * @attr ref android.R.styleable#AndroidManifestLayout_gravity
2413      * @attr ref android.R.styleable#AndroidManifestLayout_minWidth
2414      * @attr ref android.R.styleable#AndroidManifestLayout_minHeight
2415      */
2416     public static final class WindowLayout {
2417         public WindowLayout(int width, float widthFraction, int height, float heightFraction,
2418                 int gravity, int minWidth, int minHeight) {
2419             this(width, widthFraction, height, heightFraction, gravity, minWidth, minHeight,
2420                     null /* windowLayoutAffinity */);
2421         }
2422 
2423         /** @hide */
2424         public WindowLayout(int width, float widthFraction, int height, float heightFraction,
2425                 int gravity, int minWidth, int minHeight, String windowLayoutAffinity) {
2426             this.width = width;
2427             this.widthFraction = widthFraction;
2428             this.height = height;
2429             this.heightFraction = heightFraction;
2430             this.gravity = gravity;
2431             this.minWidth = minWidth;
2432             this.minHeight = minHeight;
2433             this.windowLayoutAffinity = windowLayoutAffinity;
2434         }
2435 
2436         /** @hide */
2437         public WindowLayout(Parcel source) {
2438             width = source.readInt();
2439             widthFraction = source.readFloat();
2440             height = source.readInt();
2441             heightFraction = source.readFloat();
2442             gravity = source.readInt();
2443             minWidth = source.readInt();
2444             minHeight = source.readInt();
2445             windowLayoutAffinity = source.readString8();
2446         }
2447 
2448         /**
2449          * Width of activity in pixels.
2450          *
2451          * @attr ref android.R.styleable#AndroidManifestLayout_defaultWidth
2452          */
2453         public final int width;
2454 
2455         /**
2456          * Width of activity as a fraction of available display width.
2457          * If both {@link #width} and this value are set this one will be preferred.
2458          *
2459          * @attr ref android.R.styleable#AndroidManifestLayout_defaultWidth
2460          */
2461         public final float widthFraction;
2462 
2463         /**
2464          * Height of activity in pixels.
2465          *
2466          * @attr ref android.R.styleable#AndroidManifestLayout_defaultHeight
2467          */
2468         public final int height;
2469 
2470         /**
2471          * Height of activity as a fraction of available display height.
2472          * If both {@link #height} and this value are set this one will be preferred.
2473          *
2474          * @attr ref android.R.styleable#AndroidManifestLayout_defaultHeight
2475          */
2476         public final float heightFraction;
2477 
2478         /**
2479          * Gravity of activity.
2480          * Currently {@link android.view.Gravity#TOP}, {@link android.view.Gravity#BOTTOM},
2481          * {@link android.view.Gravity#LEFT} and {@link android.view.Gravity#RIGHT} are supported.
2482          *
2483          * @attr ref android.R.styleable#AndroidManifestLayout_gravity
2484          */
2485         public final int gravity;
2486 
2487         /**
2488          * Minimal width of activity in pixels to be able to display its content.
2489          *
2490          * <p><strong>NOTE:</strong> A task's root activity value is applied to all additional
2491          * activities launched in the task. That is if the root activity of a task set minimal
2492          * width, then the system will set the same minimal width on all other activities in the
2493          * task. It will also ignore any other minimal width attributes of non-root activities.
2494          *
2495          * @attr ref android.R.styleable#AndroidManifestLayout_minWidth
2496          */
2497         public final int minWidth;
2498 
2499         /**
2500          * Minimal height of activity in pixels to be able to display its content.
2501          *
2502          * <p><strong>NOTE:</strong> A task's root activity value is applied to all additional
2503          * activities launched in the task. That is if the root activity of a task set minimal
2504          * height, then the system will set the same minimal height on all other activities in the
2505          * task. It will also ignore any other minimal height attributes of non-root activities.
2506          *
2507          * @attr ref android.R.styleable#AndroidManifestLayout_minHeight
2508          */
2509         public final int minHeight;
2510 
2511         /**
2512          * Affinity of window layout parameters. Activities with the same UID and window layout
2513          * affinity will share the same window dimension record.
2514          *
2515          * @attr ref android.R.styleable#AndroidManifestLayout_windowLayoutAffinity
2516          * @hide
2517          */
2518         public String windowLayoutAffinity;
2519 
2520         /**
2521          * Returns if this {@link WindowLayout} has specified bounds.
2522          * @hide
2523          */
2524         public boolean hasSpecifiedSize() {
2525             return width >= 0 || height >= 0 || widthFraction >= 0 || heightFraction >= 0;
2526         }
2527 
2528         /** @hide */
2529         public void writeToParcel(Parcel dest) {
2530             dest.writeInt(width);
2531             dest.writeFloat(widthFraction);
2532             dest.writeInt(height);
2533             dest.writeFloat(heightFraction);
2534             dest.writeInt(gravity);
2535             dest.writeInt(minWidth);
2536             dest.writeInt(minHeight);
2537             dest.writeString8(windowLayoutAffinity);
2538         }
2539     }
2540 }
2541