Kenny Root | 15a4d2f | 2010-03-11 18:20:12 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 17 | package android.content.pm; |
| 18 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 19 | import android.annotation.IntDef; |
Todd Kennedy | c05f5d1 | 2017-04-25 11:11:40 -0700 | [diff] [blame] | 20 | import android.content.Intent; |
Dianne Hackborn | 1d0b177 | 2013-09-06 14:02:54 -0700 | [diff] [blame] | 21 | import android.content.res.Configuration; |
Alan Viverette | ac85f90 | 2016-03-11 15:15:51 -0500 | [diff] [blame] | 22 | import android.content.res.Configuration.NativeConfig; |
Bryce Lee | 3979159 | 2017-04-26 09:29:12 -0700 | [diff] [blame] | 23 | import android.content.res.TypedArray; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 24 | import android.os.Parcel; |
| 25 | import android.os.Parcelable; |
| 26 | import android.util.Printer; |
| 27 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 28 | import java.lang.annotation.Retention; |
| 29 | import java.lang.annotation.RetentionPolicy; |
| 30 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 31 | /** |
| 32 | * Information you can retrieve about a particular application |
| 33 | * activity or receiver. This corresponds to information collected |
| 34 | * from the AndroidManifest.xml's <activity> and |
| 35 | * <receiver> tags. |
| 36 | */ |
| 37 | public class ActivityInfo extends ComponentInfo |
| 38 | implements Parcelable { |
Robert Carr | 3e2e011 | 2015-09-15 12:30:42 -0700 | [diff] [blame] | 39 | |
| 40 | // NOTE: When adding new data members be sure to update the copy-constructor, Parcel |
| 41 | // constructor, and writeToParcel. |
| 42 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 43 | /** |
| 44 | * A style resource identifier (in the package's resources) of this |
| 45 | * activity's theme. From the "theme" attribute or, if not set, 0. |
| 46 | */ |
| 47 | public int theme; |
Robert Carr | 3e2e011 | 2015-09-15 12:30:42 -0700 | [diff] [blame] | 48 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 49 | /** |
| 50 | * Constant corresponding to <code>standard</code> in |
| 51 | * the {@link android.R.attr#launchMode} attribute. |
| 52 | */ |
| 53 | public static final int LAUNCH_MULTIPLE = 0; |
| 54 | /** |
| 55 | * Constant corresponding to <code>singleTop</code> in |
| 56 | * the {@link android.R.attr#launchMode} attribute. |
| 57 | */ |
| 58 | public static final int LAUNCH_SINGLE_TOP = 1; |
| 59 | /** |
| 60 | * Constant corresponding to <code>singleTask</code> in |
| 61 | * the {@link android.R.attr#launchMode} attribute. |
| 62 | */ |
| 63 | public static final int LAUNCH_SINGLE_TASK = 2; |
| 64 | /** |
| 65 | * Constant corresponding to <code>singleInstance</code> in |
| 66 | * the {@link android.R.attr#launchMode} attribute. |
| 67 | */ |
| 68 | public static final int LAUNCH_SINGLE_INSTANCE = 3; |
| 69 | /** |
| 70 | * The launch mode style requested by the activity. From the |
| 71 | * {@link android.R.attr#launchMode} attribute, one of |
| 72 | * {@link #LAUNCH_MULTIPLE}, |
Filip Gruszczynski | d2f1d94 | 2015-10-14 15:10:12 -0700 | [diff] [blame] | 73 | * {@link #LAUNCH_SINGLE_TOP}, {@link #LAUNCH_SINGLE_TASK}, or |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 74 | * {@link #LAUNCH_SINGLE_INSTANCE}. |
| 75 | */ |
| 76 | public int launchMode; |
Craig Mautner | 2dac056 | 2014-05-06 09:06:44 -0700 | [diff] [blame] | 77 | |
| 78 | /** |
| 79 | * Constant corresponding to <code>none</code> in |
| 80 | * the {@link android.R.attr#documentLaunchMode} attribute. |
| 81 | */ |
| 82 | public static final int DOCUMENT_LAUNCH_NONE = 0; |
| 83 | /** |
| 84 | * Constant corresponding to <code>intoExisting</code> in |
| 85 | * the {@link android.R.attr#documentLaunchMode} attribute. |
| 86 | */ |
| 87 | public static final int DOCUMENT_LAUNCH_INTO_EXISTING = 1; |
| 88 | /** |
| 89 | * Constant corresponding to <code>always</code> in |
| 90 | * the {@link android.R.attr#documentLaunchMode} attribute. |
| 91 | */ |
| 92 | public static final int DOCUMENT_LAUNCH_ALWAYS = 2; |
| 93 | /** |
Craig Mautner | f357c0c | 2014-06-09 09:23:27 -0700 | [diff] [blame] | 94 | * Constant corresponding to <code>never</code> in |
| 95 | * the {@link android.R.attr#documentLaunchMode} attribute. |
| 96 | */ |
| 97 | public static final int DOCUMENT_LAUNCH_NEVER = 3; |
| 98 | /** |
Craig Mautner | 2dac056 | 2014-05-06 09:06:44 -0700 | [diff] [blame] | 99 | * The document launch mode style requested by the activity. From the |
| 100 | * {@link android.R.attr#documentLaunchMode} attribute, one of |
| 101 | * {@link #DOCUMENT_LAUNCH_NONE}, {@link #DOCUMENT_LAUNCH_INTO_EXISTING}, |
| 102 | * {@link #DOCUMENT_LAUNCH_ALWAYS}. |
| 103 | * |
| 104 | * <p>Modes DOCUMENT_LAUNCH_ALWAYS |
| 105 | * and DOCUMENT_LAUNCH_INTO_EXISTING are equivalent to {@link |
| 106 | * android.content.Intent#FLAG_ACTIVITY_NEW_DOCUMENT |
| 107 | * Intent.FLAG_ACTIVITY_NEW_DOCUMENT} with and without {@link |
| 108 | * android.content.Intent#FLAG_ACTIVITY_MULTIPLE_TASK |
| 109 | * Intent.FLAG_ACTIVITY_MULTIPLE_TASK} respectively. |
| 110 | */ |
| 111 | public int documentLaunchMode; |
| 112 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 113 | /** |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 114 | * Constant corresponding to <code>persistRootOnly</code> in |
| 115 | * the {@link android.R.attr#persistableMode} attribute. |
| 116 | */ |
| 117 | public static final int PERSIST_ROOT_ONLY = 0; |
| 118 | /** |
| 119 | * Constant corresponding to <code>doNotPersist</code> in |
| 120 | * the {@link android.R.attr#persistableMode} attribute. |
| 121 | */ |
Craig Mautner | 7f72f53 | 2014-07-21 10:07:12 -0700 | [diff] [blame] | 122 | public static final int PERSIST_NEVER = 1; |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 123 | /** |
| 124 | * Constant corresponding to <code>persistAcrossReboots</code> in |
| 125 | * the {@link android.R.attr#persistableMode} attribute. |
| 126 | */ |
| 127 | public static final int PERSIST_ACROSS_REBOOTS = 2; |
| 128 | /** |
| 129 | * Value indicating how this activity is to be persisted across |
| 130 | * reboots for restoring in the Recents list. |
| 131 | * {@link android.R.attr#persistableMode} |
| 132 | */ |
| 133 | public int persistableMode; |
| 134 | |
| 135 | /** |
Craig Mautner | ffcfcaa | 2014-06-05 09:54:38 -0700 | [diff] [blame] | 136 | * The maximum number of tasks rooted at this activity that can be in the recent task list. |
| 137 | * Refer to {@link android.R.attr#maxRecents}. |
| 138 | */ |
| 139 | public int maxRecents; |
| 140 | |
| 141 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 142 | * Optional name of a permission required to be able to access this |
| 143 | * Activity. From the "permission" attribute. |
| 144 | */ |
| 145 | public String permission; |
Filip Gruszczynski | d2f1d94 | 2015-10-14 15:10:12 -0700 | [diff] [blame] | 146 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 147 | /** |
| 148 | * The affinity this activity has for another task in the system. The |
| 149 | * string here is the name of the task, often the package name of the |
| 150 | * overall package. If null, the activity has no affinity. Set from the |
| 151 | * {@link android.R.attr#taskAffinity} attribute. |
| 152 | */ |
| 153 | public String taskAffinity; |
Filip Gruszczynski | d2f1d94 | 2015-10-14 15:10:12 -0700 | [diff] [blame] | 154 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 155 | /** |
| 156 | * If this is an activity alias, this is the real activity class to run |
| 157 | * for it. Otherwise, this is null. |
| 158 | */ |
| 159 | public String targetActivity; |
Filip Gruszczynski | d2f1d94 | 2015-10-14 15:10:12 -0700 | [diff] [blame] | 160 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 161 | /** |
Todd Kennedy | 50d946c1 | 2017-03-17 13:55:38 -0700 | [diff] [blame] | 162 | * Token used to string together multiple events within a single launch action. |
| 163 | * @hide |
| 164 | */ |
| 165 | public String launchToken; |
| 166 | |
| 167 | /** |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 168 | * Activity can not be resized and always occupies the fullscreen area with all windows fully |
| 169 | * visible. |
| 170 | * @hide |
| 171 | */ |
| 172 | public static final int RESIZE_MODE_UNRESIZEABLE = 0; |
| 173 | /** |
Wale Ogunwale | 72a73e3 | 2016-10-13 12:16:39 -0700 | [diff] [blame] | 174 | * Activity didn't explicitly request to be resizeable, but we are making it resizeable because |
Wale Ogunwale | df241e9 | 2016-10-13 15:14:21 -0700 | [diff] [blame] | 175 | * of the SDK version it targets. Only affects apps with target SDK >= N where the app is |
| 176 | * implied to be resizeable if it doesn't explicitly set the attribute to any value. |
Wale Ogunwale | 72a73e3 | 2016-10-13 12:16:39 -0700 | [diff] [blame] | 177 | * @hide |
| 178 | */ |
| 179 | public static final int RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION = 1; |
| 180 | /** |
| 181 | * Activity explicitly requested to be resizeable. |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 182 | * @hide |
| 183 | */ |
| 184 | public static final int RESIZE_MODE_RESIZEABLE = 2; |
| 185 | /** |
Winson Chung | d339538 | 2016-12-13 11:49:09 -0800 | [diff] [blame] | 186 | * Activity is resizeable and supported picture-in-picture mode. This flag is now deprecated |
| 187 | * since activities do not need to be resizeable to support picture-in-picture. |
| 188 | * See {@link #FLAG_SUPPORTS_PICTURE_IN_PICTURE}. |
| 189 | * |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 190 | * @hide |
Winson Chung | d339538 | 2016-12-13 11:49:09 -0800 | [diff] [blame] | 191 | * @deprecated |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 192 | */ |
Winson Chung | d339538 | 2016-12-13 11:49:09 -0800 | [diff] [blame] | 193 | public static final int RESIZE_MODE_RESIZEABLE_AND_PIPABLE_DEPRECATED = 3; |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 194 | /** |
skuhne@google.com | 322347b | 2016-12-02 12:54:03 -0800 | [diff] [blame] | 195 | * Activity does not support resizing, but we are forcing it to be resizeable. Only affects |
Wale Ogunwale | df241e9 | 2016-10-13 15:14:21 -0700 | [diff] [blame] | 196 | * certain pre-N apps where we force them to be resizeable. |
Wale Ogunwale | d829d36 | 2016-02-10 19:24:49 -0800 | [diff] [blame] | 197 | * @hide |
| 198 | */ |
| 199 | public static final int RESIZE_MODE_FORCE_RESIZEABLE = 4; |
| 200 | /** |
skuhne@google.com | 322347b | 2016-12-02 12:54:03 -0800 | [diff] [blame] | 201 | * Activity does not support resizing, but we are forcing it to be resizeable as long |
| 202 | * as the size remains landscape. |
| 203 | * @hide |
| 204 | */ |
| 205 | public static final int RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY = 5; |
| 206 | /** |
| 207 | * Activity does not support resizing, but we are forcing it to be resizeable as long |
| 208 | * as the size remains portrait. |
| 209 | * @hide |
| 210 | */ |
| 211 | public static final int RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY = 6; |
| 212 | /** |
| 213 | * Activity does not support resizing, but we are forcing it to be resizeable as long |
| 214 | * as the bounds remain in the same orientation as they are. |
| 215 | * @hide |
| 216 | */ |
| 217 | public static final int RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION = 7; |
| 218 | /** |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 219 | * Value indicating if the resizing mode the activity supports. |
| 220 | * See {@link android.R.attr#resizeableActivity}. |
| 221 | * @hide |
| 222 | */ |
Wale Ogunwale | 8f6c925 | 2016-04-29 16:46:47 -0700 | [diff] [blame] | 223 | public int resizeMode = RESIZE_MODE_RESIZEABLE; |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 224 | |
| 225 | /** |
Wale Ogunwale | 55ddf8f | 2017-03-20 08:56:38 -0700 | [diff] [blame] | 226 | * Value indicating the maximum aspect ratio the activity supports. |
| 227 | * <p> |
| 228 | * 0 means unset. |
| 229 | * @See {@link android.R.attr#maxAspectRatio}. |
| 230 | * @hide |
| 231 | */ |
| 232 | public float maxAspectRatio; |
| 233 | |
| 234 | /** |
Ruben Brunk | f56c9f4 | 2016-04-22 18:20:55 -0700 | [diff] [blame] | 235 | * Name of the VrListenerService component to run for this activity. |
| 236 | * @see android.R.attr#enableVrMode |
| 237 | * @hide |
| 238 | */ |
| 239 | public String requestedVrComponent; |
| 240 | |
| 241 | /** |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 242 | * Value for {@link #colorMode} indicating that the activity should use the |
| 243 | * default color mode (sRGB, low dynamic range). |
| 244 | * |
| 245 | * @see android.R.attr#colorMode |
| 246 | */ |
| 247 | public static final int COLOR_MODE_DEFAULT = 0; |
| 248 | /** |
| 249 | * Value of {@link #colorMode} indicating that the activity should use a |
| 250 | * wide color gamut if the presentation display supports it. |
| 251 | * |
| 252 | * @see android.R.attr#colorMode |
| 253 | */ |
| 254 | public static final int COLOR_MODE_WIDE_COLOR_GAMUT = 1; |
| 255 | /** |
| 256 | * Value of {@link #colorMode} indicating that the activity should use a |
| 257 | * high dynamic range if the presentation display supports it. |
| 258 | * |
| 259 | * @see android.R.attr#colorMode |
| 260 | */ |
| 261 | public static final int COLOR_MODE_HDR = 2; |
| 262 | |
| 263 | /** @hide */ |
| 264 | @IntDef({ |
| 265 | COLOR_MODE_DEFAULT, |
| 266 | COLOR_MODE_WIDE_COLOR_GAMUT, |
| 267 | COLOR_MODE_HDR, |
| 268 | }) |
| 269 | @Retention(RetentionPolicy.SOURCE) |
| 270 | public @interface ColorMode {} |
| 271 | |
| 272 | /** |
| 273 | * The color mode requested by this activity. The target display may not be |
| 274 | * able to honor the request. |
| 275 | */ |
| 276 | @ColorMode |
| 277 | public int colorMode = COLOR_MODE_DEFAULT; |
| 278 | |
| 279 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 280 | * Bit in {@link #flags} indicating whether this activity is able to |
| 281 | * run in multiple processes. If |
| 282 | * true, the system may instantiate it in the some process as the |
| 283 | * process starting it in order to conserve resources. If false, the |
| 284 | * default, it always runs in {@link #processName}. Set from the |
| 285 | * {@link android.R.attr#multiprocess} attribute. |
| 286 | */ |
| 287 | public static final int FLAG_MULTIPROCESS = 0x0001; |
| 288 | /** |
| 289 | * Bit in {@link #flags} indicating that, when the activity's task is |
| 290 | * relaunched from home, this activity should be finished. |
| 291 | * Set from the |
| 292 | * {@link android.R.attr#finishOnTaskLaunch} attribute. |
| 293 | */ |
| 294 | public static final int FLAG_FINISH_ON_TASK_LAUNCH = 0x0002; |
| 295 | /** |
| 296 | * Bit in {@link #flags} indicating that, when the activity is the root |
| 297 | * of a task, that task's stack should be cleared each time the user |
| 298 | * re-launches it from home. As a result, the user will always |
| 299 | * return to the original activity at the top of the task. |
| 300 | * This flag only applies to activities that |
| 301 | * are used to start the root of a new task. Set from the |
| 302 | * {@link android.R.attr#clearTaskOnLaunch} attribute. |
| 303 | */ |
| 304 | public static final int FLAG_CLEAR_TASK_ON_LAUNCH = 0x0004; |
| 305 | /** |
| 306 | * Bit in {@link #flags} indicating that, when the activity is the root |
| 307 | * of a task, that task's stack should never be cleared when it is |
| 308 | * relaunched from home. Set from the |
| 309 | * {@link android.R.attr#alwaysRetainTaskState} attribute. |
| 310 | */ |
| 311 | public static final int FLAG_ALWAYS_RETAIN_TASK_STATE = 0x0008; |
| 312 | /** |
| 313 | * Bit in {@link #flags} indicating that the activity's state |
| 314 | * is not required to be saved, so that if there is a failure the |
| 315 | * activity will not be removed from the activity stack. Set from the |
| 316 | * {@link android.R.attr#stateNotNeeded} attribute. |
| 317 | */ |
| 318 | public static final int FLAG_STATE_NOT_NEEDED = 0x0010; |
| 319 | /** |
| 320 | * Bit in {@link #flags} that indicates that the activity should not |
| 321 | * appear in the list of recently launched activities. Set from the |
| 322 | * {@link android.R.attr#excludeFromRecents} attribute. |
| 323 | */ |
| 324 | public static final int FLAG_EXCLUDE_FROM_RECENTS = 0x0020; |
| 325 | /** |
| 326 | * Bit in {@link #flags} that indicates that the activity can be moved |
| 327 | * between tasks based on its task affinity. Set from the |
| 328 | * {@link android.R.attr#allowTaskReparenting} attribute. |
| 329 | */ |
| 330 | public static final int FLAG_ALLOW_TASK_REPARENTING = 0x0040; |
| 331 | /** |
| 332 | * Bit in {@link #flags} indicating that, when the user navigates away |
| 333 | * from an activity, it should be finished. |
| 334 | * Set from the |
| 335 | * {@link android.R.attr#noHistory} attribute. |
| 336 | */ |
| 337 | public static final int FLAG_NO_HISTORY = 0x0080; |
| 338 | /** |
Dianne Hackborn | ffa4248 | 2009-09-23 22:20:11 -0700 | [diff] [blame] | 339 | * Bit in {@link #flags} indicating that, when a request to close system |
| 340 | * windows happens, this activity is finished. |
| 341 | * Set from the |
| 342 | * {@link android.R.attr#finishOnCloseSystemDialogs} attribute. |
| 343 | */ |
| 344 | public static final int FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS = 0x0100; |
Dianne Hackborn | 327fbd2 | 2011-01-17 14:38:50 -0800 | [diff] [blame] | 345 | /** |
| 346 | * Value for {@link #flags}: true when the application's rendering should |
| 347 | * be hardware accelerated. |
| 348 | */ |
| 349 | public static final int FLAG_HARDWARE_ACCELERATED = 0x0200; |
| 350 | /** |
Wale Ogunwale | 6dfdfd6 | 2015-04-15 12:01:38 -0700 | [diff] [blame] | 351 | * Value for {@link #flags}: true when the application can be displayed for all users |
| 352 | * regardless of if the user of the application is the current user. Set from the |
| 353 | * {@link android.R.attr#showForAllUsers} attribute. |
Craig Mautner | 5962b12 | 2012-10-05 14:45:52 -0700 | [diff] [blame] | 354 | * @hide |
| 355 | */ |
Wale Ogunwale | 6dfdfd6 | 2015-04-15 12:01:38 -0700 | [diff] [blame] | 356 | public static final int FLAG_SHOW_FOR_ALL_USERS = 0x0400; |
Craig Mautner | 5962b12 | 2012-10-05 14:45:52 -0700 | [diff] [blame] | 357 | /** |
John Spurlock | 322d771 | 2013-09-05 02:39:46 +0000 | [diff] [blame] | 358 | * Bit in {@link #flags} corresponding to an immersive activity |
Daniel Sandler | 613dde4 | 2010-06-21 13:46:39 -0400 | [diff] [blame] | 359 | * that wishes not to be interrupted by notifications. |
| 360 | * Applications that hide the system notification bar with |
| 361 | * {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN} |
| 362 | * may still be interrupted by high-priority notifications; for example, an |
| 363 | * incoming phone call may use |
Daniel Sandler | 8091ca5 | 2010-06-22 13:58:46 -0400 | [diff] [blame] | 364 | * {@link android.app.Notification#fullScreenIntent fullScreenIntent} |
Daniel Sandler | 613dde4 | 2010-06-21 13:46:39 -0400 | [diff] [blame] | 365 | * to present a full-screen in-call activity to the user, pausing the |
| 366 | * current activity as a side-effect. An activity with |
| 367 | * {@link #FLAG_IMMERSIVE} set, however, will not be interrupted; the |
| 368 | * notification may be shown in some other way (such as a small floating |
| 369 | * "toast" window). |
Christopher Tate | 73c2aee | 2012-03-15 16:27:14 -0700 | [diff] [blame] | 370 | * |
| 371 | * Note that this flag will always reflect the Activity's |
| 372 | * <code>android:immersive</code> manifest definition, even if the Activity's |
| 373 | * immersive state is changed at runtime via |
| 374 | * {@link android.app.Activity#setImmersive(boolean)}. |
| 375 | * |
| 376 | * @see android.app.Notification#FLAG_HIGH_PRIORITY |
| 377 | * @see android.app.Activity#setImmersive(boolean) |
Daniel Sandler | 613dde4 | 2010-06-21 13:46:39 -0400 | [diff] [blame] | 378 | */ |
Craig Mautner | 5962b12 | 2012-10-05 14:45:52 -0700 | [diff] [blame] | 379 | public static final int FLAG_IMMERSIVE = 0x0800; |
Romain Guy | 529b60a | 2010-08-03 18:05:47 -0700 | [diff] [blame] | 380 | /** |
Craig Mautner | 9d4e9bc | 2014-06-18 18:34:56 -0700 | [diff] [blame] | 381 | * Bit in {@link #flags}: If set, a task rooted at this activity will have its |
| 382 | * baseIntent replaced by the activity immediately above this. Each activity may further |
| 383 | * relinquish its identity to the activity above it using this flag. Set from the |
Dianne Hackborn | a4e102e | 2014-09-04 22:52:27 -0700 | [diff] [blame] | 384 | * {@link android.R.attr#relinquishTaskIdentity} attribute. |
Craig Mautner | 9d4e9bc | 2014-06-18 18:34:56 -0700 | [diff] [blame] | 385 | */ |
| 386 | public static final int FLAG_RELINQUISH_TASK_IDENTITY = 0x1000; |
| 387 | /** |
Craig Mautner | 2dac056 | 2014-05-06 09:06:44 -0700 | [diff] [blame] | 388 | * Bit in {@link #flags} indicating that tasks started with this activity are to be |
| 389 | * removed from the recent list of tasks when the last activity in the task is finished. |
Dianne Hackborn | a4e102e | 2014-09-04 22:52:27 -0700 | [diff] [blame] | 390 | * Corresponds to {@link android.R.attr#autoRemoveFromRecents} |
Craig Mautner | 2dac056 | 2014-05-06 09:06:44 -0700 | [diff] [blame] | 391 | */ |
| 392 | public static final int FLAG_AUTO_REMOVE_FROM_RECENTS = 0x2000; |
| 393 | /** |
Dianne Hackborn | a4e102e | 2014-09-04 22:52:27 -0700 | [diff] [blame] | 394 | * Bit in {@link #flags} indicating that this activity can start is creation/resume |
| 395 | * while the previous activity is still pausing. Corresponds to |
| 396 | * {@link android.R.attr#resumeWhilePausing} |
| 397 | */ |
| 398 | public static final int FLAG_RESUME_WHILE_PAUSING = 0x4000; |
| 399 | /** |
Ruben Brunk | dd18a0b | 2015-12-04 16:16:31 -0800 | [diff] [blame] | 400 | * Bit in {@link #flags} indicating that this activity should be run with VR mode enabled. |
| 401 | * |
| 402 | * {@see android.app.Activity#setVrMode(boolean)}. |
| 403 | */ |
| 404 | public static final int FLAG_ENABLE_VR_MODE = 0x8000; |
Wale Ogunwale | 6cae765 | 2015-12-26 07:36:26 -0800 | [diff] [blame] | 405 | |
| 406 | /** |
Wale Ogunwale | 6cae765 | 2015-12-26 07:36:26 -0800 | [diff] [blame] | 407 | * Bit in {@link #flags} indicating if the activity is always focusable regardless of if it is |
| 408 | * in a task/stack whose activities are normally not focusable. |
| 409 | * See android.R.attr#alwaysFocusable. |
| 410 | * @hide |
| 411 | */ |
| 412 | public static final int FLAG_ALWAYS_FOCUSABLE = 0x40000; |
| 413 | |
Ruben Brunk | dd18a0b | 2015-12-04 16:16:31 -0800 | [diff] [blame] | 414 | /** |
Todd Kennedy | c05f5d1 | 2017-04-25 11:11:40 -0700 | [diff] [blame] | 415 | * Bit in {@link #flags} indicating if the activity is visible to instant |
| 416 | * applications. The activity is visible if it's either implicitly or |
| 417 | * explicitly exposed. |
Todd Kennedy | 7bc3a70 | 2016-12-08 14:54:48 -0800 | [diff] [blame] | 418 | * @hide |
| 419 | */ |
Todd Kennedy | c05f5d1 | 2017-04-25 11:11:40 -0700 | [diff] [blame] | 420 | public static final int FLAG_VISIBLE_TO_INSTANT_APP = 0x100000; |
| 421 | |
| 422 | /** |
| 423 | * Bit in {@link #flags} indicating if the activity is implicitly visible |
| 424 | * to instant applications. Implicitly visible activities are those that |
| 425 | * implement certain intent-filters: |
| 426 | * <ul> |
| 427 | * <li>action {@link Intent#CATEGORY_BROWSABLE}</li> |
| 428 | * <li>action {@link Intent#ACTION_SEND}</li> |
| 429 | * <li>action {@link Intent#ACTION_SENDTO}</li> |
| 430 | * <li>action {@link Intent#ACTION_SEND_MULTIPLE}</li> |
| 431 | * </ul> |
| 432 | * @hide |
| 433 | */ |
| 434 | public static final int FLAG_IMPLICITLY_VISIBLE_TO_INSTANT_APP = 0x200000; |
Todd Kennedy | 7bc3a70 | 2016-12-08 14:54:48 -0800 | [diff] [blame] | 435 | |
| 436 | /** |
Winson Chung | d339538 | 2016-12-13 11:49:09 -0800 | [diff] [blame] | 437 | * Bit in {@link #flags} indicating if the activity supports picture-in-picture mode. |
| 438 | * See {@link android.R.attr#supportsPictureInPicture}. |
| 439 | * @hide |
| 440 | */ |
Todd Kennedy | c05f5d1 | 2017-04-25 11:11:40 -0700 | [diff] [blame] | 441 | public static final int FLAG_SUPPORTS_PICTURE_IN_PICTURE = 0x400000; |
chaviw | 59b9885 | 2017-06-13 12:05:44 -0700 | [diff] [blame] | 442 | |
| 443 | /** |
| 444 | * Bit in {@link #flags} indicating if the activity should be shown when locked. |
| 445 | * See {@link android.R.attr#showWhenLocked} |
| 446 | * @hide |
| 447 | */ |
| 448 | public static final int FLAG_SHOW_WHEN_LOCKED = 0x800000; |
| 449 | |
| 450 | /** |
| 451 | * Bit in {@link #flags} indicating if the screen should turn on when starting the activity. |
| 452 | * See {@link android.R.attr#turnScreenOn} |
| 453 | * @hide |
| 454 | */ |
| 455 | public static final int FLAG_TURN_SCREEN_ON = 0x1000000; |
| 456 | |
| 457 | |
Winson Chung | d339538 | 2016-12-13 11:49:09 -0800 | [diff] [blame] | 458 | /** |
Dianne Hackborn | d4ac8d7 | 2012-09-27 23:20:10 -0700 | [diff] [blame] | 459 | * @hide Bit in {@link #flags}: If set, this component will only be seen |
Fyodor Kupolov | 4f5de34 | 2015-08-25 10:08:45 -0700 | [diff] [blame] | 460 | * by the system user. Only works with broadcast receivers. Set from the |
| 461 | * android.R.attr#systemUserOnly attribute. |
Dianne Hackborn | d4ac8d7 | 2012-09-27 23:20:10 -0700 | [diff] [blame] | 462 | */ |
Fyodor Kupolov | 4f5de34 | 2015-08-25 10:08:45 -0700 | [diff] [blame] | 463 | public static final int FLAG_SYSTEM_USER_ONLY = 0x20000000; |
Dianne Hackborn | d4ac8d7 | 2012-09-27 23:20:10 -0700 | [diff] [blame] | 464 | /** |
Dianne Hackborn | 7d19e02 | 2012-08-07 19:12:33 -0700 | [diff] [blame] | 465 | * Bit in {@link #flags}: If set, a single instance of the receiver will |
| 466 | * run for all users on the device. Set from the |
| 467 | * {@link android.R.attr#singleUser} attribute. Note that this flag is |
Dianne Hackborn | d4ac8d7 | 2012-09-27 23:20:10 -0700 | [diff] [blame] | 468 | * only relevant for ActivityInfo structures that are describing receiver |
Dianne Hackborn | 7d19e02 | 2012-08-07 19:12:33 -0700 | [diff] [blame] | 469 | * components; it is not applied to activities. |
| 470 | */ |
| 471 | public static final int FLAG_SINGLE_USER = 0x40000000; |
| 472 | /** |
Craig Mautner | ffd14a1 | 2014-04-23 21:38:50 -0700 | [diff] [blame] | 473 | * @hide Bit in {@link #flags}: If set, this activity may be launched into an |
| 474 | * owned ActivityContainer such as that within an ActivityView. If not set and |
Svet Ganov | f2acc54 | 2015-11-06 09:02:00 -0800 | [diff] [blame] | 475 | * this activity is launched into such a container a SecurityException will be |
Craig Mautner | ffd14a1 | 2014-04-23 21:38:50 -0700 | [diff] [blame] | 476 | * thrown. Set from the {@link android.R.attr#allowEmbedded} attribute. |
| 477 | */ |
| 478 | public static final int FLAG_ALLOW_EMBEDDED = 0x80000000; |
chaviw | 59b9885 | 2017-06-13 12:05:44 -0700 | [diff] [blame] | 479 | |
Craig Mautner | ffd14a1 | 2014-04-23 21:38:50 -0700 | [diff] [blame] | 480 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 481 | * Options that have been set in the activity declaration in the |
Daniel Sandler | 613dde4 | 2010-06-21 13:46:39 -0400 | [diff] [blame] | 482 | * manifest. |
| 483 | * These include: |
| 484 | * {@link #FLAG_MULTIPROCESS}, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 485 | * {@link #FLAG_FINISH_ON_TASK_LAUNCH}, {@link #FLAG_CLEAR_TASK_ON_LAUNCH}, |
| 486 | * {@link #FLAG_ALWAYS_RETAIN_TASK_STATE}, |
| 487 | * {@link #FLAG_STATE_NOT_NEEDED}, {@link #FLAG_EXCLUDE_FROM_RECENTS}, |
Dianne Hackborn | ffa4248 | 2009-09-23 22:20:11 -0700 | [diff] [blame] | 488 | * {@link #FLAG_ALLOW_TASK_REPARENTING}, {@link #FLAG_NO_HISTORY}, |
Daniel Sandler | 613dde4 | 2010-06-21 13:46:39 -0400 | [diff] [blame] | 489 | * {@link #FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS}, |
Dianne Hackborn | 7d19e02 | 2012-08-07 19:12:33 -0700 | [diff] [blame] | 490 | * {@link #FLAG_HARDWARE_ACCELERATED}, {@link #FLAG_SINGLE_USER}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 491 | */ |
| 492 | public int flags; |
| 493 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 494 | /** @hide */ |
| 495 | @IntDef({ |
Wale Ogunwale | 5136249 | 2016-09-08 17:49:17 -0700 | [diff] [blame] | 496 | SCREEN_ORIENTATION_UNSET, |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 497 | SCREEN_ORIENTATION_UNSPECIFIED, |
| 498 | SCREEN_ORIENTATION_LANDSCAPE, |
| 499 | SCREEN_ORIENTATION_PORTRAIT, |
| 500 | SCREEN_ORIENTATION_USER, |
| 501 | SCREEN_ORIENTATION_BEHIND, |
| 502 | SCREEN_ORIENTATION_SENSOR, |
| 503 | SCREEN_ORIENTATION_NOSENSOR, |
| 504 | SCREEN_ORIENTATION_SENSOR_LANDSCAPE, |
| 505 | SCREEN_ORIENTATION_SENSOR_PORTRAIT, |
| 506 | SCREEN_ORIENTATION_REVERSE_LANDSCAPE, |
| 507 | SCREEN_ORIENTATION_REVERSE_PORTRAIT, |
| 508 | SCREEN_ORIENTATION_FULL_SENSOR, |
| 509 | SCREEN_ORIENTATION_USER_LANDSCAPE, |
| 510 | SCREEN_ORIENTATION_USER_PORTRAIT, |
| 511 | SCREEN_ORIENTATION_FULL_USER, |
| 512 | SCREEN_ORIENTATION_LOCKED |
| 513 | }) |
| 514 | @Retention(RetentionPolicy.SOURCE) |
| 515 | public @interface ScreenOrientation {} |
| 516 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 517 | /** |
Wale Ogunwale | 5136249 | 2016-09-08 17:49:17 -0700 | [diff] [blame] | 518 | * Internal constant used to indicate that the app didn't set a specific orientation value. |
| 519 | * Different from {@link #SCREEN_ORIENTATION_UNSPECIFIED} below as the app can set its |
| 520 | * orientation to {@link #SCREEN_ORIENTATION_UNSPECIFIED} while this means that the app didn't |
| 521 | * set anything. The system will mostly treat this similar to |
| 522 | * {@link #SCREEN_ORIENTATION_UNSPECIFIED}. |
| 523 | * @hide |
| 524 | */ |
| 525 | public static final int SCREEN_ORIENTATION_UNSET = -2; |
| 526 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 527 | * Constant corresponding to <code>unspecified</code> in |
| 528 | * the {@link android.R.attr#screenOrientation} attribute. |
| 529 | */ |
| 530 | public static final int SCREEN_ORIENTATION_UNSPECIFIED = -1; |
| 531 | /** |
| 532 | * Constant corresponding to <code>landscape</code> in |
| 533 | * the {@link android.R.attr#screenOrientation} attribute. |
| 534 | */ |
| 535 | public static final int SCREEN_ORIENTATION_LANDSCAPE = 0; |
| 536 | /** |
| 537 | * Constant corresponding to <code>portrait</code> in |
| 538 | * the {@link android.R.attr#screenOrientation} attribute. |
| 539 | */ |
| 540 | public static final int SCREEN_ORIENTATION_PORTRAIT = 1; |
| 541 | /** |
| 542 | * Constant corresponding to <code>user</code> in |
| 543 | * the {@link android.R.attr#screenOrientation} attribute. |
| 544 | */ |
| 545 | public static final int SCREEN_ORIENTATION_USER = 2; |
| 546 | /** |
| 547 | * Constant corresponding to <code>behind</code> in |
| 548 | * the {@link android.R.attr#screenOrientation} attribute. |
| 549 | */ |
| 550 | public static final int SCREEN_ORIENTATION_BEHIND = 3; |
| 551 | /** |
| 552 | * Constant corresponding to <code>sensor</code> in |
| 553 | * the {@link android.R.attr#screenOrientation} attribute. |
| 554 | */ |
| 555 | public static final int SCREEN_ORIENTATION_SENSOR = 4; |
Filip Gruszczynski | d2f1d94 | 2015-10-14 15:10:12 -0700 | [diff] [blame] | 556 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 557 | /** |
Dianne Hackborn | e5439f2 | 2010-10-02 16:53:50 -0700 | [diff] [blame] | 558 | * Constant corresponding to <code>nosensor</code> in |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 559 | * the {@link android.R.attr#screenOrientation} attribute. |
| 560 | */ |
| 561 | public static final int SCREEN_ORIENTATION_NOSENSOR = 5; |
Dianne Hackborn | e5439f2 | 2010-10-02 16:53:50 -0700 | [diff] [blame] | 562 | |
| 563 | /** |
| 564 | * Constant corresponding to <code>sensorLandscape</code> in |
| 565 | * the {@link android.R.attr#screenOrientation} attribute. |
| 566 | */ |
| 567 | public static final int SCREEN_ORIENTATION_SENSOR_LANDSCAPE = 6; |
| 568 | |
| 569 | /** |
| 570 | * Constant corresponding to <code>sensorPortrait</code> in |
| 571 | * the {@link android.R.attr#screenOrientation} attribute. |
| 572 | */ |
| 573 | public static final int SCREEN_ORIENTATION_SENSOR_PORTRAIT = 7; |
| 574 | |
| 575 | /** |
| 576 | * Constant corresponding to <code>reverseLandscape</code> in |
| 577 | * the {@link android.R.attr#screenOrientation} attribute. |
| 578 | */ |
| 579 | public static final int SCREEN_ORIENTATION_REVERSE_LANDSCAPE = 8; |
| 580 | |
| 581 | /** |
| 582 | * Constant corresponding to <code>reversePortrait</code> in |
| 583 | * the {@link android.R.attr#screenOrientation} attribute. |
| 584 | */ |
| 585 | public static final int SCREEN_ORIENTATION_REVERSE_PORTRAIT = 9; |
| 586 | |
| 587 | /** |
| 588 | * Constant corresponding to <code>fullSensor</code> in |
| 589 | * the {@link android.R.attr#screenOrientation} attribute. |
| 590 | */ |
| 591 | public static final int SCREEN_ORIENTATION_FULL_SENSOR = 10; |
| 592 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 593 | /** |
Dianne Hackborn | b9ec1ac | 2013-04-10 17:34:25 -0700 | [diff] [blame] | 594 | * Constant corresponding to <code>userLandscape</code> in |
| 595 | * the {@link android.R.attr#screenOrientation} attribute. |
| 596 | */ |
| 597 | public static final int SCREEN_ORIENTATION_USER_LANDSCAPE = 11; |
| 598 | |
| 599 | /** |
| 600 | * Constant corresponding to <code>userPortrait</code> in |
| 601 | * the {@link android.R.attr#screenOrientation} attribute. |
| 602 | */ |
| 603 | public static final int SCREEN_ORIENTATION_USER_PORTRAIT = 12; |
| 604 | |
| 605 | /** |
| 606 | * Constant corresponding to <code>fullUser</code> in |
| 607 | * the {@link android.R.attr#screenOrientation} attribute. |
| 608 | */ |
| 609 | public static final int SCREEN_ORIENTATION_FULL_USER = 13; |
| 610 | |
| 611 | /** |
| 612 | * Constant corresponding to <code>locked</code> in |
| 613 | * the {@link android.R.attr#screenOrientation} attribute. |
| 614 | */ |
| 615 | public static final int SCREEN_ORIENTATION_LOCKED = 14; |
| 616 | |
| 617 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 618 | * The preferred screen orientation this activity would like to run in. |
| 619 | * From the {@link android.R.attr#screenOrientation} attribute, one of |
| 620 | * {@link #SCREEN_ORIENTATION_UNSPECIFIED}, |
Filip Gruszczynski | d2f1d94 | 2015-10-14 15:10:12 -0700 | [diff] [blame] | 621 | * {@link #SCREEN_ORIENTATION_LANDSCAPE}, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 622 | * {@link #SCREEN_ORIENTATION_PORTRAIT}, |
| 623 | * {@link #SCREEN_ORIENTATION_USER}, |
| 624 | * {@link #SCREEN_ORIENTATION_BEHIND}, |
| 625 | * {@link #SCREEN_ORIENTATION_SENSOR}, |
Dianne Hackborn | e5439f2 | 2010-10-02 16:53:50 -0700 | [diff] [blame] | 626 | * {@link #SCREEN_ORIENTATION_NOSENSOR}, |
| 627 | * {@link #SCREEN_ORIENTATION_SENSOR_LANDSCAPE}, |
| 628 | * {@link #SCREEN_ORIENTATION_SENSOR_PORTRAIT}, |
| 629 | * {@link #SCREEN_ORIENTATION_REVERSE_LANDSCAPE}, |
| 630 | * {@link #SCREEN_ORIENTATION_REVERSE_PORTRAIT}, |
Dianne Hackborn | b9ec1ac | 2013-04-10 17:34:25 -0700 | [diff] [blame] | 631 | * {@link #SCREEN_ORIENTATION_FULL_SENSOR}, |
| 632 | * {@link #SCREEN_ORIENTATION_USER_LANDSCAPE}, |
| 633 | * {@link #SCREEN_ORIENTATION_USER_PORTRAIT}, |
| 634 | * {@link #SCREEN_ORIENTATION_FULL_USER}, |
| 635 | * {@link #SCREEN_ORIENTATION_LOCKED}, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 636 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 637 | @ScreenOrientation |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 638 | public int screenOrientation = SCREEN_ORIENTATION_UNSPECIFIED; |
Filip Gruszczynski | d2f1d94 | 2015-10-14 15:10:12 -0700 | [diff] [blame] | 639 | |
Alan Viverette | ac85f90 | 2016-03-11 15:15:51 -0500 | [diff] [blame] | 640 | /** @hide */ |
| 641 | @IntDef(flag = true, |
| 642 | value = { |
| 643 | CONFIG_MCC, |
| 644 | CONFIG_MNC, |
| 645 | CONFIG_LOCALE, |
| 646 | CONFIG_TOUCHSCREEN, |
| 647 | CONFIG_KEYBOARD, |
| 648 | CONFIG_KEYBOARD_HIDDEN, |
| 649 | CONFIG_NAVIGATION, |
| 650 | CONFIG_ORIENTATION, |
| 651 | CONFIG_SCREEN_LAYOUT, |
| 652 | CONFIG_UI_MODE, |
| 653 | CONFIG_SCREEN_SIZE, |
| 654 | CONFIG_SMALLEST_SCREEN_SIZE, |
| 655 | CONFIG_DENSITY, |
| 656 | CONFIG_LAYOUT_DIRECTION, |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 657 | CONFIG_COLOR_MODE, |
Alan Viverette | ac85f90 | 2016-03-11 15:15:51 -0500 | [diff] [blame] | 658 | CONFIG_FONT_SCALE, |
| 659 | }) |
| 660 | @Retention(RetentionPolicy.SOURCE) |
| 661 | public @interface Config {} |
| 662 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 663 | /** |
| 664 | * Bit in {@link #configChanges} that indicates that the activity |
| 665 | * can itself handle changes to the IMSI MCC. Set from the |
| 666 | * {@link android.R.attr#configChanges} attribute. |
| 667 | */ |
| 668 | public static final int CONFIG_MCC = 0x0001; |
| 669 | /** |
| 670 | * Bit in {@link #configChanges} that indicates that the activity |
| 671 | * can itself handle changes to the IMSI MNC. Set from the |
| 672 | * {@link android.R.attr#configChanges} attribute. |
| 673 | */ |
| 674 | public static final int CONFIG_MNC = 0x0002; |
| 675 | /** |
| 676 | * Bit in {@link #configChanges} that indicates that the activity |
| 677 | * can itself handle changes to the locale. Set from the |
| 678 | * {@link android.R.attr#configChanges} attribute. |
| 679 | */ |
| 680 | public static final int CONFIG_LOCALE = 0x0004; |
| 681 | /** |
| 682 | * Bit in {@link #configChanges} that indicates that the activity |
| 683 | * can itself handle changes to the touchscreen type. Set from the |
| 684 | * {@link android.R.attr#configChanges} attribute. |
| 685 | */ |
| 686 | public static final int CONFIG_TOUCHSCREEN = 0x0008; |
| 687 | /** |
| 688 | * Bit in {@link #configChanges} that indicates that the activity |
| 689 | * can itself handle changes to the keyboard type. Set from the |
| 690 | * {@link android.R.attr#configChanges} attribute. |
| 691 | */ |
| 692 | public static final int CONFIG_KEYBOARD = 0x0010; |
| 693 | /** |
| 694 | * Bit in {@link #configChanges} that indicates that the activity |
Dianne Hackborn | 93e462b | 2009-09-15 22:50:40 -0700 | [diff] [blame] | 695 | * can itself handle changes to the keyboard or navigation being hidden/exposed. |
| 696 | * Note that inspite of the name, this applies to the changes to any |
| 697 | * hidden states: keyboard or navigation. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 698 | * Set from the {@link android.R.attr#configChanges} attribute. |
| 699 | */ |
| 700 | public static final int CONFIG_KEYBOARD_HIDDEN = 0x0020; |
| 701 | /** |
| 702 | * Bit in {@link #configChanges} that indicates that the activity |
| 703 | * can itself handle changes to the navigation type. Set from the |
| 704 | * {@link android.R.attr#configChanges} attribute. |
| 705 | */ |
| 706 | public static final int CONFIG_NAVIGATION = 0x0040; |
| 707 | /** |
| 708 | * Bit in {@link #configChanges} that indicates that the activity |
| 709 | * can itself handle changes to the screen orientation. Set from the |
| 710 | * {@link android.R.attr#configChanges} attribute. |
| 711 | */ |
| 712 | public static final int CONFIG_ORIENTATION = 0x0080; |
| 713 | /** |
| 714 | * Bit in {@link #configChanges} that indicates that the activity |
Dianne Hackborn | 723738c | 2009-06-25 19:48:04 -0700 | [diff] [blame] | 715 | * can itself handle changes to the screen layout. Set from the |
| 716 | * {@link android.R.attr#configChanges} attribute. |
| 717 | */ |
| 718 | public static final int CONFIG_SCREEN_LAYOUT = 0x0100; |
| 719 | /** |
| 720 | * Bit in {@link #configChanges} that indicates that the activity |
Tobias Haamel | 27b28b3 | 2010-02-09 23:09:17 +0100 | [diff] [blame] | 721 | * can itself handle the ui mode. Set from the |
| 722 | * {@link android.R.attr#configChanges} attribute. |
Tobias Haamel | 27b28b3 | 2010-02-09 23:09:17 +0100 | [diff] [blame] | 723 | */ |
| 724 | public static final int CONFIG_UI_MODE = 0x0200; |
| 725 | /** |
| 726 | * Bit in {@link #configChanges} that indicates that the activity |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 727 | * can itself handle the screen size. Set from the |
Dianne Hackborn | e667635 | 2011-06-01 16:51:20 -0700 | [diff] [blame] | 728 | * {@link android.R.attr#configChanges} attribute. This will be |
| 729 | * set by default for applications that target an earlier version |
| 730 | * than {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}... |
| 731 | * <b>however</b>, you will not see the bit set here becomes some |
| 732 | * applications incorrectly compare {@link #configChanges} against |
| 733 | * an absolute value rather than correctly masking out the bits |
| 734 | * they are interested in. Please don't do that, thanks. |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 735 | */ |
| 736 | public static final int CONFIG_SCREEN_SIZE = 0x0400; |
| 737 | /** |
| 738 | * Bit in {@link #configChanges} that indicates that the activity |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 739 | * can itself handle the smallest screen size. Set from the |
Dianne Hackborn | e667635 | 2011-06-01 16:51:20 -0700 | [diff] [blame] | 740 | * {@link android.R.attr#configChanges} attribute. This will be |
| 741 | * set by default for applications that target an earlier version |
| 742 | * than {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}... |
| 743 | * <b>however</b>, you will not see the bit set here becomes some |
| 744 | * applications incorrectly compare {@link #configChanges} against |
| 745 | * an absolute value rather than correctly masking out the bits |
| 746 | * they are interested in. Please don't do that, thanks. |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 747 | */ |
| 748 | public static final int CONFIG_SMALLEST_SCREEN_SIZE = 0x0800; |
| 749 | /** |
| 750 | * Bit in {@link #configChanges} that indicates that the activity |
Dianne Hackborn | 908aecc | 2012-07-31 16:37:34 -0700 | [diff] [blame] | 751 | * can itself handle density changes. Set from the |
| 752 | * {@link android.R.attr#configChanges} attribute. |
| 753 | */ |
| 754 | public static final int CONFIG_DENSITY = 0x1000; |
| 755 | /** |
| 756 | * Bit in {@link #configChanges} that indicates that the activity |
Fabrice Di Meglio | 5f79799 | 2012-06-15 20:16:41 -0700 | [diff] [blame] | 757 | * can itself handle the change to layout direction. Set from the |
| 758 | * {@link android.R.attr#configChanges} attribute. |
| 759 | */ |
| 760 | public static final int CONFIG_LAYOUT_DIRECTION = 0x2000; |
| 761 | /** |
| 762 | * Bit in {@link #configChanges} that indicates that the activity |
Romain Guy | c9ba559 | 2017-01-18 16:34:42 -0800 | [diff] [blame] | 763 | * can itself handle the change to the display color gamut or dynamic |
| 764 | * range. Set from the {@link android.R.attr#configChanges} attribute. |
| 765 | */ |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 766 | public static final int CONFIG_COLOR_MODE = 0x4000; |
Romain Guy | c9ba559 | 2017-01-18 16:34:42 -0800 | [diff] [blame] | 767 | /** |
| 768 | * Bit in {@link #configChanges} that indicates that the activity |
MÃ¥rten Kongstad | 49a4a1d | 2017-01-12 08:36:37 +0100 | [diff] [blame] | 769 | * can itself handle asset path changes. Set from the {@link android.R.attr#configChanges} |
| 770 | * attribute. This is not a core resource configuration, but a higher-level value, so its |
| 771 | * constant starts at the high bits. |
| 772 | * @hide We do not want apps handling this yet, but we do need some kind of bit for diffs. |
| 773 | */ |
| 774 | public static final int CONFIG_ASSETS_PATHS = 0x80000000; |
| 775 | /** |
| 776 | * Bit in {@link #configChanges} that indicates that the activity |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 777 | * can itself handle changes to the font scaling factor. Set from the |
| 778 | * {@link android.R.attr#configChanges} attribute. This is |
Fabrice Di Meglio | dc25d25 | 2013-04-09 18:04:29 -0700 | [diff] [blame] | 779 | * not a core resource configuration, but a higher-level value, so its |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 780 | * constant starts at the high bits. |
| 781 | */ |
| 782 | public static final int CONFIG_FONT_SCALE = 0x40000000; |
Filip Gruszczynski | d2f1d94 | 2015-10-14 15:10:12 -0700 | [diff] [blame] | 783 | |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 784 | /** @hide |
| 785 | * Unfortunately the constants for config changes in native code are |
| 786 | * different from ActivityInfo. :( Here are the values we should use for the |
| 787 | * native side given the bit we have assigned in ActivityInfo. |
| 788 | */ |
| 789 | public static int[] CONFIG_NATIVE_BITS = new int[] { |
Dianne Hackborn | 1d0b177 | 2013-09-06 14:02:54 -0700 | [diff] [blame] | 790 | Configuration.NATIVE_CONFIG_MNC, // MNC |
| 791 | Configuration.NATIVE_CONFIG_MCC, // MCC |
| 792 | Configuration.NATIVE_CONFIG_LOCALE, // LOCALE |
| 793 | Configuration.NATIVE_CONFIG_TOUCHSCREEN, // TOUCH SCREEN |
| 794 | Configuration.NATIVE_CONFIG_KEYBOARD, // KEYBOARD |
| 795 | Configuration.NATIVE_CONFIG_KEYBOARD_HIDDEN, // KEYBOARD HIDDEN |
| 796 | Configuration.NATIVE_CONFIG_NAVIGATION, // NAVIGATION |
| 797 | Configuration.NATIVE_CONFIG_ORIENTATION, // ORIENTATION |
| 798 | Configuration.NATIVE_CONFIG_SCREEN_LAYOUT, // SCREEN LAYOUT |
| 799 | Configuration.NATIVE_CONFIG_UI_MODE, // UI MODE |
| 800 | Configuration.NATIVE_CONFIG_SCREEN_SIZE, // SCREEN SIZE |
| 801 | Configuration.NATIVE_CONFIG_SMALLEST_SCREEN_SIZE, // SMALLEST SCREEN SIZE |
| 802 | Configuration.NATIVE_CONFIG_DENSITY, // DENSITY |
| 803 | Configuration.NATIVE_CONFIG_LAYOUTDIR, // LAYOUT DIRECTION |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 804 | Configuration.NATIVE_CONFIG_COLOR_MODE, // COLOR_MODE |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 805 | }; |
Alan Viverette | c1d5279 | 2015-05-05 09:49:03 -0700 | [diff] [blame] | 806 | |
| 807 | /** |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 808 | * Convert Java change bits to native. |
Alan Viverette | c1d5279 | 2015-05-05 09:49:03 -0700 | [diff] [blame] | 809 | * |
| 810 | * @hide |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 811 | */ |
Alan Viverette | ac85f90 | 2016-03-11 15:15:51 -0500 | [diff] [blame] | 812 | public static @NativeConfig int activityInfoConfigJavaToNative(@Config int input) { |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 813 | int output = 0; |
Alan Viverette | c1d5279 | 2015-05-05 09:49:03 -0700 | [diff] [blame] | 814 | for (int i = 0; i < CONFIG_NATIVE_BITS.length; i++) { |
| 815 | if ((input & (1 << i)) != 0) { |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 816 | output |= CONFIG_NATIVE_BITS[i]; |
| 817 | } |
| 818 | } |
| 819 | return output; |
| 820 | } |
| 821 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 822 | /** |
Alan Viverette | c1d5279 | 2015-05-05 09:49:03 -0700 | [diff] [blame] | 823 | * Convert native change bits to Java. |
| 824 | * |
| 825 | * @hide |
| 826 | */ |
Alan Viverette | ac85f90 | 2016-03-11 15:15:51 -0500 | [diff] [blame] | 827 | public static @Config int activityInfoConfigNativeToJava(@NativeConfig int input) { |
Alan Viverette | c1d5279 | 2015-05-05 09:49:03 -0700 | [diff] [blame] | 828 | int output = 0; |
| 829 | for (int i = 0; i < CONFIG_NATIVE_BITS.length; i++) { |
| 830 | if ((input & CONFIG_NATIVE_BITS[i]) != 0) { |
| 831 | output |= (1 << i); |
| 832 | } |
| 833 | } |
| 834 | return output; |
| 835 | } |
| 836 | |
| 837 | /** |
Dianne Hackborn | e667635 | 2011-06-01 16:51:20 -0700 | [diff] [blame] | 838 | * @hide |
| 839 | * Unfortunately some developers (OpenFeint I am looking at you) have |
| 840 | * compared the configChanges bit field against absolute values, so if we |
| 841 | * introduce a new bit they break. To deal with that, we will make sure |
| 842 | * the public field will not have a value that breaks them, and let the |
| 843 | * framework call here to get the real value. |
| 844 | */ |
| 845 | public int getRealConfigChanged() { |
| 846 | return applicationInfo.targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB_MR2 |
| 847 | ? (configChanges | ActivityInfo.CONFIG_SCREEN_SIZE |
| 848 | | ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE) |
| 849 | : configChanges; |
| 850 | } |
| 851 | |
| 852 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 853 | * Bit mask of kinds of configuration changes that this activity |
| 854 | * can handle itself (without being restarted by the system). |
| 855 | * Contains any combination of {@link #CONFIG_FONT_SCALE}, |
| 856 | * {@link #CONFIG_MCC}, {@link #CONFIG_MNC}, |
| 857 | * {@link #CONFIG_LOCALE}, {@link #CONFIG_TOUCHSCREEN}, |
Dianne Hackborn | 723738c | 2009-06-25 19:48:04 -0700 | [diff] [blame] | 858 | * {@link #CONFIG_KEYBOARD}, {@link #CONFIG_NAVIGATION}, |
Alan Viverette | 28c4a0b | 2015-11-20 17:23:46 -0500 | [diff] [blame] | 859 | * {@link #CONFIG_ORIENTATION}, {@link #CONFIG_SCREEN_LAYOUT}, |
Romain Guy | c9ba559 | 2017-01-18 16:34:42 -0800 | [diff] [blame] | 860 | * {@link #CONFIG_DENSITY}, {@link #CONFIG_LAYOUT_DIRECTION} and |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 861 | * {@link #CONFIG_COLOR_MODE}. |
Alan Viverette | 28c4a0b | 2015-11-20 17:23:46 -0500 | [diff] [blame] | 862 | * Set from the {@link android.R.attr#configChanges} attribute. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 863 | */ |
| 864 | public int configChanges; |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 865 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 866 | /** |
| 867 | * The desired soft input mode for this activity's main window. |
| 868 | * Set from the {@link android.R.attr#windowSoftInputMode} attribute |
| 869 | * in the activity's manifest. May be any of the same values allowed |
| 870 | * for {@link android.view.WindowManager.LayoutParams#softInputMode |
| 871 | * WindowManager.LayoutParams.softInputMode}. If 0 (unspecified), |
| 872 | * the mode from the theme will be used. |
| 873 | */ |
Yohei Yukawa | 22dac1c | 2017-02-12 16:54:16 -0800 | [diff] [blame] | 874 | @android.view.WindowManager.LayoutParams.SoftInputModeFlags |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 875 | public int softInputMode; |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 876 | |
| 877 | /** |
| 878 | * The desired extra UI options for this activity and its main window. |
| 879 | * Set from the {@link android.R.attr#uiOptions} attribute in the |
| 880 | * activity's manifest. |
| 881 | */ |
| 882 | public int uiOptions = 0; |
| 883 | |
| 884 | /** |
Scott Main | e797ed6 | 2011-09-22 16:17:45 -0700 | [diff] [blame] | 885 | * Flag for use with {@link #uiOptions}. |
| 886 | * Indicates that the action bar should put all action items in a separate bar when |
| 887 | * the screen is narrow. |
| 888 | * <p>This value corresponds to "splitActionBarWhenNarrow" for the {@link #uiOptions} XML |
| 889 | * attribute. |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 890 | */ |
| 891 | public static final int UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW = 1; |
| 892 | |
Adam Powell | dd8fab2 | 2012-03-22 17:47:27 -0700 | [diff] [blame] | 893 | /** |
| 894 | * If defined, the activity named here is the logical parent of this activity. |
| 895 | */ |
| 896 | public String parentActivityName; |
| 897 | |
Robert Carr | 0f5d753 | 2016-10-17 16:39:17 -0700 | [diff] [blame] | 898 | /** |
| 899 | * Screen rotation animation desired by the activity, with values as defined |
| 900 | * for {@link android.view.WindowManager.LayoutParams#rotationAnimation}. |
Robert Carr | c0149bf | 2017-05-01 15:22:22 -0700 | [diff] [blame] | 901 | * |
| 902 | * -1 means to use the system default. |
| 903 | * |
Robert Carr | 0f5d753 | 2016-10-17 16:39:17 -0700 | [diff] [blame] | 904 | * @hide |
| 905 | */ |
Robert Carr | c0149bf | 2017-05-01 15:22:22 -0700 | [diff] [blame] | 906 | public int rotationAnimation = -1; |
Robert Carr | 0f5d753 | 2016-10-17 16:39:17 -0700 | [diff] [blame] | 907 | |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 908 | /** @hide */ |
| 909 | public static final int LOCK_TASK_LAUNCH_MODE_DEFAULT = 0; |
| 910 | /** @hide */ |
| 911 | public static final int LOCK_TASK_LAUNCH_MODE_NEVER = 1; |
| 912 | /** @hide */ |
| 913 | public static final int LOCK_TASK_LAUNCH_MODE_ALWAYS = 2; |
| 914 | /** @hide */ |
| 915 | public static final int LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED = 3; |
| 916 | |
| 917 | /** @hide */ |
| 918 | public static final String lockTaskLaunchModeToString(int lockTaskLaunchMode) { |
| 919 | switch (lockTaskLaunchMode) { |
| 920 | case LOCK_TASK_LAUNCH_MODE_DEFAULT: |
| 921 | return "LOCK_TASK_LAUNCH_MODE_DEFAULT"; |
| 922 | case LOCK_TASK_LAUNCH_MODE_NEVER: |
| 923 | return "LOCK_TASK_LAUNCH_MODE_NEVER"; |
| 924 | case LOCK_TASK_LAUNCH_MODE_ALWAYS: |
| 925 | return "LOCK_TASK_LAUNCH_MODE_ALWAYS"; |
| 926 | case LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED: |
| 927 | return "LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED"; |
| 928 | default: |
| 929 | return "unknown=" + lockTaskLaunchMode; |
| 930 | } |
| 931 | } |
| 932 | /** |
| 933 | * Value indicating if the activity is to be locked at startup. Takes on the values from |
| 934 | * {@link android.R.attr#lockTaskMode}. |
| 935 | * @hide |
| 936 | */ |
| 937 | public int lockTaskLaunchMode; |
| 938 | |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 939 | /** |
| 940 | * Information about desired position and size of activity on the display when |
| 941 | * it is first started. |
| 942 | */ |
| 943 | public WindowLayout windowLayout; |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 944 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 945 | public ActivityInfo() { |
| 946 | } |
| 947 | |
| 948 | public ActivityInfo(ActivityInfo orig) { |
| 949 | super(orig); |
| 950 | theme = orig.theme; |
| 951 | launchMode = orig.launchMode; |
Robert Carr | 3e2e011 | 2015-09-15 12:30:42 -0700 | [diff] [blame] | 952 | documentLaunchMode = orig.documentLaunchMode; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 953 | permission = orig.permission; |
| 954 | taskAffinity = orig.taskAffinity; |
| 955 | targetActivity = orig.targetActivity; |
| 956 | flags = orig.flags; |
| 957 | screenOrientation = orig.screenOrientation; |
| 958 | configChanges = orig.configChanges; |
| 959 | softInputMode = orig.softInputMode; |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 960 | uiOptions = orig.uiOptions; |
Adam Powell | dd8fab2 | 2012-03-22 17:47:27 -0700 | [diff] [blame] | 961 | parentActivityName = orig.parentActivityName; |
Craig Mautner | 8307ea7 | 2014-09-11 15:03:53 -0700 | [diff] [blame] | 962 | maxRecents = orig.maxRecents; |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 963 | lockTaskLaunchMode = orig.lockTaskLaunchMode; |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 964 | windowLayout = orig.windowLayout; |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 965 | resizeMode = orig.resizeMode; |
Ruben Brunk | f56c9f4 | 2016-04-22 18:20:55 -0700 | [diff] [blame] | 966 | requestedVrComponent = orig.requestedVrComponent; |
Robert Carr | 0f5d753 | 2016-10-17 16:39:17 -0700 | [diff] [blame] | 967 | rotationAnimation = orig.rotationAnimation; |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 968 | colorMode = orig.colorMode; |
Wale Ogunwale | 55ddf8f | 2017-03-20 08:56:38 -0700 | [diff] [blame] | 969 | maxAspectRatio = orig.maxAspectRatio; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 970 | } |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 971 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 972 | /** |
| 973 | * Return the theme resource identifier to use for this activity. If |
| 974 | * the activity defines a theme, that is used; else, the application |
| 975 | * theme is used. |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 976 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 977 | * @return The theme associated with this activity. |
| 978 | */ |
| 979 | public final int getThemeResource() { |
| 980 | return theme != 0 ? theme : applicationInfo.theme; |
| 981 | } |
| 982 | |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 983 | private String persistableModeToString() { |
| 984 | switch(persistableMode) { |
| 985 | case PERSIST_ROOT_ONLY: return "PERSIST_ROOT_ONLY"; |
Craig Mautner | 7f72f53 | 2014-07-21 10:07:12 -0700 | [diff] [blame] | 986 | case PERSIST_NEVER: return "PERSIST_NEVER"; |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 987 | case PERSIST_ACROSS_REBOOTS: return "PERSIST_ACROSS_REBOOTS"; |
| 988 | default: return "UNKNOWN=" + persistableMode; |
| 989 | } |
| 990 | } |
| 991 | |
Wale Ogunwale | 508ff55 | 2016-02-15 19:31:50 -0800 | [diff] [blame] | 992 | /** |
| 993 | * Returns true if the activity's orientation is fixed. |
| 994 | * @hide |
| 995 | */ |
Bryce Lee | 3979159 | 2017-04-26 09:29:12 -0700 | [diff] [blame] | 996 | public boolean isFixedOrientation() { |
skuhne@google.com | 322347b | 2016-12-02 12:54:03 -0800 | [diff] [blame] | 997 | return isFixedOrientationLandscape() || isFixedOrientationPortrait() |
Wale Ogunwale | 508ff55 | 2016-02-15 19:31:50 -0800 | [diff] [blame] | 998 | || screenOrientation == SCREEN_ORIENTATION_LOCKED; |
| 999 | } |
| 1000 | |
skuhne@google.com | 322347b | 2016-12-02 12:54:03 -0800 | [diff] [blame] | 1001 | /** |
Bryce Lee | 3979159 | 2017-04-26 09:29:12 -0700 | [diff] [blame] | 1002 | * Returns true if the specified orientation is considered fixed. |
| 1003 | * @hide |
| 1004 | */ |
| 1005 | static public boolean isFixedOrientation(int orientation) { |
| 1006 | return isFixedOrientationLandscape(orientation) || isFixedOrientationPortrait(orientation); |
| 1007 | } |
| 1008 | |
| 1009 | /** |
skuhne@google.com | 322347b | 2016-12-02 12:54:03 -0800 | [diff] [blame] | 1010 | * Returns true if the activity's orientation is fixed to landscape. |
| 1011 | * @hide |
| 1012 | */ |
| 1013 | boolean isFixedOrientationLandscape() { |
Wale Ogunwale | d4b1d1e | 2017-04-10 06:35:59 -0700 | [diff] [blame] | 1014 | return isFixedOrientationLandscape(screenOrientation); |
| 1015 | } |
| 1016 | |
| 1017 | /** |
| 1018 | * Returns true if the activity's orientation is fixed to landscape. |
| 1019 | * @hide |
| 1020 | */ |
| 1021 | public static boolean isFixedOrientationLandscape(@ScreenOrientation int orientation) { |
| 1022 | return orientation == SCREEN_ORIENTATION_LANDSCAPE |
| 1023 | || orientation == SCREEN_ORIENTATION_SENSOR_LANDSCAPE |
| 1024 | || orientation == SCREEN_ORIENTATION_REVERSE_LANDSCAPE |
| 1025 | || orientation == SCREEN_ORIENTATION_USER_LANDSCAPE; |
skuhne@google.com | 322347b | 2016-12-02 12:54:03 -0800 | [diff] [blame] | 1026 | } |
| 1027 | |
| 1028 | /** |
| 1029 | * Returns true if the activity's orientation is fixed to portrait. |
| 1030 | * @hide |
| 1031 | */ |
| 1032 | boolean isFixedOrientationPortrait() { |
Wale Ogunwale | d4b1d1e | 2017-04-10 06:35:59 -0700 | [diff] [blame] | 1033 | return isFixedOrientationPortrait(screenOrientation); |
| 1034 | } |
| 1035 | |
| 1036 | /** |
| 1037 | * Returns true if the activity's orientation is fixed to portrait. |
| 1038 | * @hide |
| 1039 | */ |
| 1040 | public static boolean isFixedOrientationPortrait(@ScreenOrientation int orientation) { |
| 1041 | return orientation == SCREEN_ORIENTATION_PORTRAIT |
| 1042 | || orientation == SCREEN_ORIENTATION_SENSOR_PORTRAIT |
| 1043 | || orientation == SCREEN_ORIENTATION_REVERSE_PORTRAIT |
| 1044 | || orientation == SCREEN_ORIENTATION_USER_PORTRAIT; |
skuhne@google.com | 322347b | 2016-12-02 12:54:03 -0800 | [diff] [blame] | 1045 | } |
| 1046 | |
Winson Chung | d339538 | 2016-12-13 11:49:09 -0800 | [diff] [blame] | 1047 | /** |
| 1048 | * Returns true if the activity supports picture-in-picture. |
| 1049 | * @hide |
| 1050 | */ |
| 1051 | public boolean supportsPictureInPicture() { |
| 1052 | return (flags & FLAG_SUPPORTS_PICTURE_IN_PICTURE) != 0; |
| 1053 | } |
| 1054 | |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 1055 | /** @hide */ |
Wale Ogunwale | b1faf60 | 2016-01-27 09:12:31 -0800 | [diff] [blame] | 1056 | public static boolean isResizeableMode(int mode) { |
Wale Ogunwale | d829d36 | 2016-02-10 19:24:49 -0800 | [diff] [blame] | 1057 | return mode == RESIZE_MODE_RESIZEABLE |
Wale Ogunwale | 72a73e3 | 2016-10-13 12:16:39 -0700 | [diff] [blame] | 1058 | || mode == RESIZE_MODE_FORCE_RESIZEABLE |
skuhne@google.com | 322347b | 2016-12-02 12:54:03 -0800 | [diff] [blame] | 1059 | || mode == RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY |
| 1060 | || mode == RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY |
| 1061 | || mode == RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION |
Wale Ogunwale | 72a73e3 | 2016-10-13 12:16:39 -0700 | [diff] [blame] | 1062 | || mode == RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION; |
Wale Ogunwale | b1faf60 | 2016-01-27 09:12:31 -0800 | [diff] [blame] | 1063 | } |
| 1064 | |
| 1065 | /** @hide */ |
skuhne@google.com | 322347b | 2016-12-02 12:54:03 -0800 | [diff] [blame] | 1066 | public static boolean isPreserveOrientationMode(int mode) { |
| 1067 | return mode == RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY |
| 1068 | || mode == RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY |
| 1069 | || mode == RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION; |
| 1070 | } |
| 1071 | |
| 1072 | /** @hide */ |
Wale Ogunwale | b1faf60 | 2016-01-27 09:12:31 -0800 | [diff] [blame] | 1073 | public static String resizeModeToString(int mode) { |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 1074 | switch (mode) { |
| 1075 | case RESIZE_MODE_UNRESIZEABLE: |
| 1076 | return "RESIZE_MODE_UNRESIZEABLE"; |
Wale Ogunwale | 72a73e3 | 2016-10-13 12:16:39 -0700 | [diff] [blame] | 1077 | case RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION: |
| 1078 | return "RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION"; |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 1079 | case RESIZE_MODE_RESIZEABLE: |
| 1080 | return "RESIZE_MODE_RESIZEABLE"; |
Wale Ogunwale | d829d36 | 2016-02-10 19:24:49 -0800 | [diff] [blame] | 1081 | case RESIZE_MODE_FORCE_RESIZEABLE: |
| 1082 | return "RESIZE_MODE_FORCE_RESIZEABLE"; |
skuhne@google.com | 322347b | 2016-12-02 12:54:03 -0800 | [diff] [blame] | 1083 | case RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY: |
| 1084 | return "RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY"; |
| 1085 | case RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY: |
| 1086 | return "RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY"; |
| 1087 | case RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION: |
| 1088 | return "RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION"; |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 1089 | default: |
| 1090 | return "unknown=" + mode; |
| 1091 | } |
| 1092 | } |
| 1093 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1094 | public void dump(Printer pw, String prefix) { |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 1095 | dump(pw, prefix, DUMP_FLAG_ALL); |
| 1096 | } |
| 1097 | |
| 1098 | /** @hide */ |
| 1099 | public void dump(Printer pw, String prefix, int flags) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1100 | super.dumpFront(pw, prefix); |
Dianne Hackborn | 12527f9 | 2009-11-11 17:39:50 -0800 | [diff] [blame] | 1101 | if (permission != null) { |
| 1102 | pw.println(prefix + "permission=" + permission); |
| 1103 | } |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 1104 | if ((flags&DUMP_FLAG_DETAILS) != 0) { |
| 1105 | pw.println(prefix + "taskAffinity=" + taskAffinity |
| 1106 | + " targetActivity=" + targetActivity |
| 1107 | + " persistableMode=" + persistableModeToString()); |
| 1108 | } |
Dianne Hackborn | 12527f9 | 2009-11-11 17:39:50 -0800 | [diff] [blame] | 1109 | if (launchMode != 0 || flags != 0 || theme != 0) { |
| 1110 | pw.println(prefix + "launchMode=" + launchMode |
| 1111 | + " flags=0x" + Integer.toHexString(flags) |
| 1112 | + " theme=0x" + Integer.toHexString(theme)); |
| 1113 | } |
| 1114 | if (screenOrientation != SCREEN_ORIENTATION_UNSPECIFIED |
| 1115 | || configChanges != 0 || softInputMode != 0) { |
| 1116 | pw.println(prefix + "screenOrientation=" + screenOrientation |
| 1117 | + " configChanges=0x" + Integer.toHexString(configChanges) |
| 1118 | + " softInputMode=0x" + Integer.toHexString(softInputMode)); |
| 1119 | } |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 1120 | if (uiOptions != 0) { |
| 1121 | pw.println(prefix + " uiOptions=0x" + Integer.toHexString(uiOptions)); |
| 1122 | } |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 1123 | if ((flags&DUMP_FLAG_DETAILS) != 0) { |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 1124 | pw.println(prefix + "lockTaskLaunchMode=" |
| 1125 | + lockTaskLaunchModeToString(lockTaskLaunchMode)); |
| 1126 | } |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1127 | if (windowLayout != null) { |
| 1128 | pw.println(prefix + "windowLayout=" + windowLayout.width + "|" |
| 1129 | + windowLayout.widthFraction + ", " + windowLayout.height + "|" |
| 1130 | + windowLayout.heightFraction + ", " + windowLayout.gravity); |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1131 | } |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 1132 | pw.println(prefix + "resizeMode=" + resizeModeToString(resizeMode)); |
Ruben Brunk | f56c9f4 | 2016-04-22 18:20:55 -0700 | [diff] [blame] | 1133 | if (requestedVrComponent != null) { |
| 1134 | pw.println(prefix + "requestedVrComponent=" + requestedVrComponent); |
| 1135 | } |
Wale Ogunwale | 55ddf8f | 2017-03-20 08:56:38 -0700 | [diff] [blame] | 1136 | if (maxAspectRatio != 0) { |
| 1137 | pw.println(prefix + "maxAspectRatio=" + maxAspectRatio); |
| 1138 | } |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 1139 | super.dumpBack(pw, prefix, flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1140 | } |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1141 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1142 | public String toString() { |
| 1143 | return "ActivityInfo{" |
| 1144 | + Integer.toHexString(System.identityHashCode(this)) |
| 1145 | + " " + name + "}"; |
| 1146 | } |
| 1147 | |
| 1148 | public int describeContents() { |
| 1149 | return 0; |
| 1150 | } |
| 1151 | |
| 1152 | public void writeToParcel(Parcel dest, int parcelableFlags) { |
| 1153 | super.writeToParcel(dest, parcelableFlags); |
| 1154 | dest.writeInt(theme); |
| 1155 | dest.writeInt(launchMode); |
Robert Carr | 3e2e011 | 2015-09-15 12:30:42 -0700 | [diff] [blame] | 1156 | dest.writeInt(documentLaunchMode); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1157 | dest.writeString(permission); |
| 1158 | dest.writeString(taskAffinity); |
| 1159 | dest.writeString(targetActivity); |
| 1160 | dest.writeInt(flags); |
| 1161 | dest.writeInt(screenOrientation); |
| 1162 | dest.writeInt(configChanges); |
| 1163 | dest.writeInt(softInputMode); |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 1164 | dest.writeInt(uiOptions); |
Adam Powell | dd8fab2 | 2012-03-22 17:47:27 -0700 | [diff] [blame] | 1165 | dest.writeString(parentActivityName); |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 1166 | dest.writeInt(persistableMode); |
Craig Mautner | 8307ea7 | 2014-09-11 15:03:53 -0700 | [diff] [blame] | 1167 | dest.writeInt(maxRecents); |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 1168 | dest.writeInt(lockTaskLaunchMode); |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1169 | if (windowLayout != null) { |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1170 | dest.writeInt(1); |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1171 | dest.writeInt(windowLayout.width); |
| 1172 | dest.writeFloat(windowLayout.widthFraction); |
| 1173 | dest.writeInt(windowLayout.height); |
| 1174 | dest.writeFloat(windowLayout.heightFraction); |
| 1175 | dest.writeInt(windowLayout.gravity); |
Andrii Kulian | f66a83d | 2016-05-17 12:17:44 -0700 | [diff] [blame] | 1176 | dest.writeInt(windowLayout.minWidth); |
| 1177 | dest.writeInt(windowLayout.minHeight); |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1178 | } else { |
| 1179 | dest.writeInt(0); |
| 1180 | } |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 1181 | dest.writeInt(resizeMode); |
Ruben Brunk | f56c9f4 | 2016-04-22 18:20:55 -0700 | [diff] [blame] | 1182 | dest.writeString(requestedVrComponent); |
Robert Carr | 0f5d753 | 2016-10-17 16:39:17 -0700 | [diff] [blame] | 1183 | dest.writeInt(rotationAnimation); |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 1184 | dest.writeInt(colorMode); |
Wale Ogunwale | 55ddf8f | 2017-03-20 08:56:38 -0700 | [diff] [blame] | 1185 | dest.writeFloat(maxAspectRatio); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1186 | } |
| 1187 | |
Bryce Lee | 3979159 | 2017-04-26 09:29:12 -0700 | [diff] [blame] | 1188 | /** |
| 1189 | * Determines whether the {@link Activity} is considered translucent or floating. |
| 1190 | * @hide |
| 1191 | */ |
| 1192 | public static boolean isTranslucentOrFloating(TypedArray attributes) { |
| 1193 | final boolean isTranslucent = |
| 1194 | attributes.getBoolean(com.android.internal.R.styleable.Window_windowIsTranslucent, |
| 1195 | false); |
| 1196 | final boolean isSwipeToDismiss = !attributes.hasValue( |
| 1197 | com.android.internal.R.styleable.Window_windowIsTranslucent) |
| 1198 | && attributes.getBoolean( |
| 1199 | com.android.internal.R.styleable.Window_windowSwipeToDismiss, false); |
| 1200 | final boolean isFloating = |
| 1201 | attributes.getBoolean(com.android.internal.R.styleable.Window_windowIsFloating, |
| 1202 | false); |
| 1203 | |
| 1204 | return isFloating || isTranslucent || isSwipeToDismiss; |
| 1205 | } |
| 1206 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1207 | public static final Parcelable.Creator<ActivityInfo> CREATOR |
| 1208 | = new Parcelable.Creator<ActivityInfo>() { |
| 1209 | public ActivityInfo createFromParcel(Parcel source) { |
| 1210 | return new ActivityInfo(source); |
| 1211 | } |
| 1212 | public ActivityInfo[] newArray(int size) { |
| 1213 | return new ActivityInfo[size]; |
| 1214 | } |
| 1215 | }; |
| 1216 | |
| 1217 | private ActivityInfo(Parcel source) { |
| 1218 | super(source); |
| 1219 | theme = source.readInt(); |
| 1220 | launchMode = source.readInt(); |
Robert Carr | 3e2e011 | 2015-09-15 12:30:42 -0700 | [diff] [blame] | 1221 | documentLaunchMode = source.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1222 | permission = source.readString(); |
| 1223 | taskAffinity = source.readString(); |
| 1224 | targetActivity = source.readString(); |
| 1225 | flags = source.readInt(); |
| 1226 | screenOrientation = source.readInt(); |
| 1227 | configChanges = source.readInt(); |
| 1228 | softInputMode = source.readInt(); |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 1229 | uiOptions = source.readInt(); |
Adam Powell | dd8fab2 | 2012-03-22 17:47:27 -0700 | [diff] [blame] | 1230 | parentActivityName = source.readString(); |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 1231 | persistableMode = source.readInt(); |
Craig Mautner | 8307ea7 | 2014-09-11 15:03:53 -0700 | [diff] [blame] | 1232 | maxRecents = source.readInt(); |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 1233 | lockTaskLaunchMode = source.readInt(); |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1234 | if (source.readInt() == 1) { |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1235 | windowLayout = new WindowLayout(source); |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1236 | } |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 1237 | resizeMode = source.readInt(); |
Ruben Brunk | f56c9f4 | 2016-04-22 18:20:55 -0700 | [diff] [blame] | 1238 | requestedVrComponent = source.readString(); |
Robert Carr | 0f5d753 | 2016-10-17 16:39:17 -0700 | [diff] [blame] | 1239 | rotationAnimation = source.readInt(); |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 1240 | colorMode = source.readInt(); |
Wale Ogunwale | 55ddf8f | 2017-03-20 08:56:38 -0700 | [diff] [blame] | 1241 | maxAspectRatio = source.readFloat(); |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1242 | } |
| 1243 | |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1244 | /** |
| 1245 | * Contains information about position and size of the activity on the display. |
| 1246 | * |
| 1247 | * Used in freeform mode to set desired position when activity is first launched. |
| 1248 | * It describes how big the activity wants to be in both width and height, |
| 1249 | * the minimal allowed size, and the gravity to be applied. |
| 1250 | * |
| 1251 | * @attr ref android.R.styleable#AndroidManifestLayout_defaultWidth |
| 1252 | * @attr ref android.R.styleable#AndroidManifestLayout_defaultHeight |
| 1253 | * @attr ref android.R.styleable#AndroidManifestLayout_gravity |
Andrii Kulian | f66a83d | 2016-05-17 12:17:44 -0700 | [diff] [blame] | 1254 | * @attr ref android.R.styleable#AndroidManifestLayout_minWidth |
| 1255 | * @attr ref android.R.styleable#AndroidManifestLayout_minHeight |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1256 | */ |
| 1257 | public static final class WindowLayout { |
| 1258 | public WindowLayout(int width, float widthFraction, int height, float heightFraction, int gravity, |
Andrii Kulian | f66a83d | 2016-05-17 12:17:44 -0700 | [diff] [blame] | 1259 | int minWidth, int minHeight) { |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1260 | this.width = width; |
| 1261 | this.widthFraction = widthFraction; |
| 1262 | this.height = height; |
| 1263 | this.heightFraction = heightFraction; |
| 1264 | this.gravity = gravity; |
Andrii Kulian | f66a83d | 2016-05-17 12:17:44 -0700 | [diff] [blame] | 1265 | this.minWidth = minWidth; |
| 1266 | this.minHeight = minHeight; |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1267 | } |
| 1268 | |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1269 | WindowLayout(Parcel source) { |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1270 | width = source.readInt(); |
| 1271 | widthFraction = source.readFloat(); |
| 1272 | height = source.readInt(); |
| 1273 | heightFraction = source.readFloat(); |
| 1274 | gravity = source.readInt(); |
Andrii Kulian | f66a83d | 2016-05-17 12:17:44 -0700 | [diff] [blame] | 1275 | minWidth = source.readInt(); |
| 1276 | minHeight = source.readInt(); |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1277 | } |
| 1278 | |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1279 | /** |
| 1280 | * Width of activity in pixels. |
| 1281 | * |
| 1282 | * @attr ref android.R.styleable#AndroidManifestLayout_defaultWidth |
| 1283 | */ |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1284 | public final int width; |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1285 | |
| 1286 | /** |
| 1287 | * Width of activity as a fraction of available display width. |
| 1288 | * If both {@link #width} and this value are set this one will be preferred. |
| 1289 | * |
| 1290 | * @attr ref android.R.styleable#AndroidManifestLayout_defaultWidth |
| 1291 | */ |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1292 | public final float widthFraction; |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1293 | |
| 1294 | /** |
| 1295 | * Height of activity in pixels. |
| 1296 | * |
| 1297 | * @attr ref android.R.styleable#AndroidManifestLayout_defaultHeight |
| 1298 | */ |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1299 | public final int height; |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1300 | |
| 1301 | /** |
| 1302 | * Height of activity as a fraction of available display height. |
| 1303 | * If both {@link #height} and this value are set this one will be preferred. |
| 1304 | * |
| 1305 | * @attr ref android.R.styleable#AndroidManifestLayout_defaultHeight |
| 1306 | */ |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1307 | public final float heightFraction; |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1308 | |
| 1309 | /** |
| 1310 | * Gravity of activity. |
| 1311 | * Currently {@link android.view.Gravity#TOP}, {@link android.view.Gravity#BOTTOM}, |
| 1312 | * {@link android.view.Gravity#LEFT} and {@link android.view.Gravity#RIGHT} are supported. |
| 1313 | * |
| 1314 | * @attr ref android.R.styleable#AndroidManifestLayout_gravity |
| 1315 | */ |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1316 | public final int gravity; |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1317 | |
| 1318 | /** |
| 1319 | * Minimal width of activity in pixels to be able to display its content. |
| 1320 | * |
| 1321 | * <p><strong>NOTE:</strong> A task's root activity value is applied to all additional |
| 1322 | * activities launched in the task. That is if the root activity of a task set minimal |
| 1323 | * width, then the system will set the same minimal width on all other activities in the |
| 1324 | * task. It will also ignore any other minimal width attributes of non-root activities. |
| 1325 | * |
Andrii Kulian | f66a83d | 2016-05-17 12:17:44 -0700 | [diff] [blame] | 1326 | * @attr ref android.R.styleable#AndroidManifestLayout_minWidth |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1327 | */ |
Andrii Kulian | f66a83d | 2016-05-17 12:17:44 -0700 | [diff] [blame] | 1328 | public final int minWidth; |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1329 | |
| 1330 | /** |
| 1331 | * Minimal height of activity in pixels to be able to display its content. |
| 1332 | * |
| 1333 | * <p><strong>NOTE:</strong> A task's root activity value is applied to all additional |
| 1334 | * activities launched in the task. That is if the root activity of a task set minimal |
| 1335 | * height, then the system will set the same minimal height on all other activities in the |
| 1336 | * task. It will also ignore any other minimal height attributes of non-root activities. |
| 1337 | * |
Andrii Kulian | f66a83d | 2016-05-17 12:17:44 -0700 | [diff] [blame] | 1338 | * @attr ref android.R.styleable#AndroidManifestLayout_minHeight |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1339 | */ |
Andrii Kulian | f66a83d | 2016-05-17 12:17:44 -0700 | [diff] [blame] | 1340 | public final int minHeight; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1341 | } |
| 1342 | } |