summaryrefslogtreecommitdiff
path: root/core/java/android/app/FragmentManager.java
Commit message (Collapse)AuthorAgeFilesLines
* Migrate frameworks/base javadocs references to androidxAlan Viverette2022-02-091-5/+5
| | | | | | | | | | | Does not remove Support Library artifacts from docs classpath (ApiDocs.bp) because they are still used in development/samples, which is not as easy to migrate as javadoc. Bug: 158779503 Test: make docs Exempt-From-Owner-Approval: Mass find/replace for androidx migration Change-Id: Icf7f53ec36a0e970413352e2ebf40ce9d60ed17e
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-291-1/+1
| | | | | | | | | | | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. This is a resubmit of ag/12929664 with some APIs excluded that caused test failures; see bugs 171886397, 171888296, 171864568. APIs excluded: Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord; Landroid/os/Process;->myPpid()I Landroid/os/SharedMemory;->getFd()I Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I Bug: 170729553 Test: Treehugger Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
* Revert "Add maxTargetSdk restriction to unused APIs."Hongwei Wang2020-10-281-1/+1
| | | | | | | | | This reverts commit 72f07d6a8a32db4a0dedd7682a0b3385be2b9cd6. Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?testMethod=testAppZygotePreload&testClass=android.app.cts.ServiceTest&atpConfigName=suite%2Ftest-mapping-presubmit-retry_cloud-tf&testModule=CtsAppTestCases&fkbb=6936597&lkbb=6936969&lkgb=6936551&testResults=true&branch=git_master&target=cf_x86_phone-userdebug>, bug b/171886397 Bug: 171886397 Change-Id: Ibe0f0430a3451477c1ee8ef56a596e91ea1e7672
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-271-1/+1
| | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. Bug: 170729553 Test: Treehugger Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
* Use new UnsupportedAppUsage annotation.Artur Satayev2019-12-181-1/+1
| | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I8789f8499d4dca08580672e9e45ed9a7026dd686
* All Parcelable CREATOR fields are @NonNull.Jeff Sharkey2019-02-281-1/+1
| | | | | | | | | If they were null, then the Parcelable would fail to work. Bug: 126726802 Test: manual Change-Id: I7929ffa2f20e5de1c8e68e8263cca99496e9d014 Exempt-From-Owner-Approval: Trivial API annotations
* Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | For packages: android.app.usage android.app.trust android.app.timezonedetector android.app.timezone android.app.timedetector android.app.job android.app.backup android.app.assist android.app.admin android.app This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I618c5dc4462ae990d9df45c3e9ed3f092cc5138c
* Improve Fragment+Loader deprecation JavadocIan Lake2017-12-201-4/+11
| | | | | | | | | | | | | | | Make it clear that the framework versions of Fragments and Loaders should be replaced with their identically named versions in the Support Library. Reference the recent work on Lifecycle as an example of a Support Library only change that should motivate developers to switch to the Support Library equivalents. Test: Reviewed new Javadoc BUG: 70336450 Change-Id: I93151fa0a316bba824c2e55f80f7de9d30bed3c6
* Deprecate framework Fragments and LoadersIan Lake2017-11-131-0/+12
| | | | | | | | | | | | Redirect developers to use the Support Library versions of Fragments and Loaders to ensure that they get consistent behavior across versions of Android and all devices as well as access to Lifecycle improvements. Test: Confirmed APIs deprecated in current.txt BUG: 68381801 Change-Id: I58ec599e557fc93c8547c45ba7c9ced96b0c8616
* Fix problem with empty AnimatorSet during fragment removal.George Mount2017-09-131-2/+7
| | | | | | | | | | | Bug: 65354043 When an empty AnimatorSet is used in a fragment animation, it can end immediately. This CL properly detects this case and handles it properly. Test: manual, ran fragment CTS Change-Id: I63bee3818106f9c8e86cdc94af61d6bc8407c789
* Fix Fragment.onCreate() not being called in some cases.George Mount2017-07-191-1/+1
| | | | | | | | | | | | | | | | | | | Bug 62798751 When an application process has been killed with a retained instance fragment on its back stack, and a configuration change causes state save, the retained instance fragment was not calling onCreate() when it was popped back into existence. The cause of the problem is that the mRetaining flag was being set, and when it was supposed to go through onCreate(), it was skipped. This CL uses a new flag to judge whether or not a Fragment has called onCreate() or not. Test: I512f8c174f557ee7ed18a9b9dc5c0c3e7a5843a5 Support Lib Change: Ia66a1f474d815f657b6962097139c796f7fa198b Change-Id: Ia7878f4ac67ee8cfa05903ba6749ab9851f603ee
* Protect FragmentManager from Menu calls while not CREATED.George Mount2017-07-111-0/+15
| | | | | | | | | | | | | | Bug 62673781 While the FragmentManager is not at least in the CREATED state, it should not call any methods related to Menu to any of its Fragments. This can happen after the FragmentManager has been destroyed, but before the Activity has been replaced. Test: I1357dcd5d6498a6d35552ee68a5fbda9de89b764 Support Lib Change: I6a34b5a95ad69190377eaa4afda041c6b9ef925b Change-Id: I1a93812b7fa6be0d784d2160f8208939259698c8
* Merge "Add target sdk check for behavior change." into oc-dev am: e5e246ce5c ↵George Mount2017-06-101-3/+5
|\ | | | | | | | | | | | | | | am: 62a18e12a3 am: 3e9429be6a Change-Id: Ia5d655f3ce6bb760574bd5abd02115d9284ea395
| * Merge "Add target sdk check for behavior change." into oc-devGeorge Mount2017-06-091-3/+5
| |\ | | | | | | | | | | | | | | | am: e5e246ce5c Change-Id: I3734ee5cd46536a015a8fc60bf8b57818800c792
| | * Add target sdk check for behavior change.George Mount2017-06-081-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 62188967 A previous change stopped animations on fragment Views before being removed. This change in behavior caused other problems, so the behavior must be placed behind a target SDK check. Test: ran fragment tests, validated on app Change-Id: I098e9b0f1472d9838abeacba3baaa7581f7a82ad
* | | Fix SynchronizeOnNonFinalField warning in FragmentManager.Aurimas Liutikas2017-06-071-51/+3
|/ / | | | | | | | | | | Bug: 62269464 Test: ./gradlew assembleErrorProne Change-Id: I2246475941ea606466172f4da941fc3b9db72c5b
* | Merge "Fix warnings surfaced by error-prone."TreeHugger Robot2017-05-251-133/+87
|\ \ | |/ |/|
| * Fix warnings surfaced by error-prone.George Mount2017-05-241-133/+87
| | | | | | | | | | | | | | | | | | | | | | Bug 36033775 Error-prone discovered that mAdded is created after usage, but can be accessed on any thread. This makes mAdded a final value so that it cannot be created on one thread and accessed on another. Test: ran cts fragment tests Change-Id: I4e655a6cef9d924f392c021d9d2a9ae2d0dc0519
* | Correctly save retained fragments in the backstacksergeyv2017-05-231-13/+15
|/ | | | | | Test: FragmentLifecycleTest#retainedFragmentsInBackstack bug:62027280 Change-Id: I4ba20c5138f957107422c46d67095c7c8db2c608
* Fix back stack problems due to postponed transitionsGeorge Mount2017-05-151-1/+5
| | | | | | | | | | | | | Bug 38277003 The back stack was being moved while executing operations and then again when the postponed transaction was executed. It should only be done once. Test: Ie47e1f2f158325b9cfd6edb5c40c65d764ff9056 Support Lib Change: I3159c2345a7b77fa82f1c602f4639f51b5a47980 Change-Id: I3b7a032e7e8a9aec565157d42dcaa7232b256ae8
* Remove duplicated onBackStackChanged() call.George Mount2017-05-021-1/+0
| | | | | | | | | | | | Bug 37433435 We were reporting onBackStackChanged() twice, once when the operations are collected and once when the operations are executed. This CL only reports the onBackStackChanged() after the operations are executed. Test: Ife6a3eb12124a5409ca6a1bbc9332c056fe4f30a Change-Id: I699c314c40331f4859ea7ff725c5835e07036f18
* Address API feedback for new fragment APIsAdam Powell2017-04-271-0/+32
| | | | | | | | | | | Framework edition Bug: 37637473 Bug: 37636731 Bug: 37638276 Test: run fragment tests Change-Id: I3e77ab51d60f5a550d60701fc81a84e143a53244
* Address API council feedback.George Mount2017-04-261-30/+31
| | | | | | | | | | Bug 37636027 Change FragmentTransaction#setAllowOptimization() to FragmentTransaction#setReorderingAllowed(). Test: I729dc05bde1f6eba6ff8d38eb15f65de777c14bb Change-Id: I24c35aad95ffa14d2e2fa092ae71d3d459e6d648
* Merge "Fix/suppress error-prone warnings in framework's fragment." into oc-devAurimas Liutikas2017-04-211-0/+9
|\
| * Fix/suppress error-prone warnings in framework's fragment.Aurimas Liutikas2017-04-201-0/+9
| | | | | | | | | | | | Bug: 37537860 Test: Compile Change-Id: I0f30c423a712819ee78d16764acf20386360240f
* | Merge "Kill running animations on fragment view's when removed." into oc-devTreeHugger Robot2017-04-201-0/+3
|\ \
| * | Kill running animations on fragment view's when removed.George Mount2017-04-191-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 29274792 Stop animation and animators on the Fragment view from preventing the view from being removed from the shadow view hierarchy. Support Lib: I628b38f76357bce1ca7dd5c5c736f0f087d7bab4 Test: Ie9a11692ae883a72c17a042168feec42c698074e Change-Id: I0ada7b4e75ef14c90038adf316b196e4cbcd6aaa
* | | Merge "Execute pending transactions after FM state change." into oc-devTreeHugger Robot2017-04-201-0/+1
|\ \ \
| * | | Execute pending transactions after FM state change.George Mount2017-04-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 37255517 Because we no longer allow reentrant transactions during fragment manager state changes, we must have the pending transactions execute as soon as the state changes. This allows developers to avoid calling executePendingTransactions() in lifecycle calls. Support Lib: Icdecc018c7cb02f69a694b52c711ba9056469aa5 Test: I269c4c26224c9142d3800a30054f9ddd5b456edb Change-Id: I849dde6482465e633df33243d99710ebf538cc9a
* | | | fix NPE when fragment container is nullGeorge Mount2017-04-201-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 37529822 Test: ran against breaking application Change-Id: Ib829b817eddf2e91898989a2f9e7885a6f5847e5
* | | | Merge "Fix FragmentTransaction.show() to show the fragment." into oc-devTreeHugger Robot2017-04-191-3/+7
|\ \ \ \
| * | | | Fix FragmentTransaction.show() to show the fragment.George Mount2017-04-191-3/+7
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 37413327 When there was an animation and the fragment transaction wasn't optimized, the fragment visiiblity wasn't being set during show(). Test: I0fd4029a02d6c9f082011bf56f0d3c8245803f68 Change-Id: Idc2c74ae2fc4759a755a5988ce6ca1b39ef8d554
* / | | Adds getLayoutInflater() to return a cached value.George Mount2017-04-171-2/+2
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 37156970 Many applications need to get the LayoutInflater used for fragment View inflation. onGetLayoutInflater() can be heavy weight, so a version that caches that last value is added. Support Lib: I11d719d7416a5bb3b65f37a78e6ed96a69c32332 Test: I6aa0ecfe7136d133d15a597857f6cf6f3cf68fca Change-Id: I686d5b39f7a046396fff124c33c22a73952ee5d7
* / / Update more implementations of findViewById()Alan Viverette2017-04-131-1/+1
|/ / | | | | | | | | | | Bug: 24137209 Test: make checkbuild -j32 Change-Id: I104969fc74d6dc1d159e3d1ff5926640b124a540
* | Merge "Save FragmentManagerNonConfig during onSaveInstanceState()" into oc-devTreeHugger Robot2017-04-061-4/+40
|\ \
| * | Save FragmentManagerNonConfig during onSaveInstanceState()George Mount2017-04-051-4/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 36815706 onSaveInstanceState() is called prior to onStop(), but onRetainNonConfigInstance() is called after. When a retained instance fragment is added during onStop(), the state of the two configurations won't match. This CL moves the non-configuration save to happen immediately after the save instance state. Support Lib Change: Ib41cbe02d060d3411e32d1494525e119d0c23dd7 Test: I30e598abf7faceac3294aef1ee0ee3b07d3aa7c6 Change-Id: I861629e2c6da2d8b0e075e8283b631fdf80670c0
* | | Merge "Change getFragments() to return a List." into oc-devTreeHugger Robot2017-04-061-5/+8
|\ \ \ | |/ / |/| |
| * | Change getFragments() to return a List.George Mount2017-04-051-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 36762718 Bug 36982279 Changes getFragments() to return a List instead of a Collection. The order is the order in which the fragment is added or attached. Test: ran fragment cts tests Change-Id: I10bbeef13e9154bbe052127cfa0e160b2e500b4d
* | | Call noteStateNotSaved on child fragment managers.George Mount2017-04-051-1/+8
|/ / | | | | | | | | | | | | | | | | | | | | | | | | Bug 36740474 When onNewIntent() is called, it calls noteStateNotSaved on the FragmentManager. It wasn't propagating that to child FragmentManagers. This CL properly propagates the noteStateNotSaved(). Test: I7cf360a4ed82ee34797896dc110477731c8206c0 Change-Id: Icfcbc385ef68657145b05cb59d5b2a70fe020992
* | Merge "Fix saving target fragment when Fragment not yet created." into oc-devTreeHugger Robot2017-04-041-2/+7
|\ \
| * | Fix saving target fragment when Fragment not yet created.George Mount2017-04-031-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 35928527 During optimized transactions, a fragment may be removed without being created. That leaves the state of the fragment in INITIALIZING and previously, that state wasn't ever saved. This CL allows a fragment that is being removed to be brought up to the CREATED state so that it can be saved during saveAllState(). Test: manual and Ie7207cc647312d38b377405bc5ec8721db757d2e Change-Id: I649f1931745be43087ec3578e9195624e80821dc
* | | Merge "Ensuring multi-window callbacks contain new configuration and are in ↵Winson Chung2017-04-031-0/+34
|\ \ \ | | | | | | | | | | | | order" into oc-dev
| * | | Ensuring multi-window callbacks contain new configuration and are in orderWinson Chung2017-03-311-0/+34
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - This CL has two main changes: 1) It modifies the activity multi-window and picture-in-picture mode changed callbacks to provide the configuration of the activity with the mode applied. 2) It modifies the order in which the multi-window and picture-in-picture mode callbacks are made, to ensure that when going in and out of picture-in-picture: first PiP, then MW, and then the config change. - Previously, the ordering of the two callbacks was inconsistent. When calling moveActivityToPinnedStack(), we reparent the task into the pinned stack (triggering the picture-in-picture mode change), followed by the resize animation (causes configuration changes). Inversely, when we expand the task to fullscreen (and not just remove it), we run the animation first, which resizes the task to the final size (causes configuration changes) then reparent after the animation completes (triggering the picture-in-picture mode change). In this CL, we ensure that for both the transition in and out of PiP, we defer to the bounds animation to trigger the PiP mode change. Normal calls to reparent or adding a new task are unchanged. When the PiP mode change is called from the animation, it provides the final target bounds which we use to calculate the target configuration of the activity for the callback. If the bounds animation is interrupted, an update will also be scheduled if we change the fullscreen state we are animating to. To work around the issue where we are scheduling MW/PiP mode changes in both the animation and the configuration change, we also now keep track of each state internally in the ActivityRecord. Bug: 36099777 Test: android.server.cts.ActivityManagerPinnedStackTests Test: #testConfigurationChangeOrderDuringTransition Change-Id: I03513bc3a4d4a72c250983f22f079ce9d7a2cb40 Signed-off-by: Winson Chung <winsonc@google.com>
* / / Allow committing allowing state loss on detached FragmentManager.George Mount2017-03-301-0/+8
|/ / | | | | | | | | | | | | | | | | | | | | Bug 36702993 Instead of throwing an exception during commitAllowStateLoss() or commitNowAllowingStateLoss(), silently drop the transaction when the FragmentManager is detached. Test: I7093457c2b4936b95ab086dbe947571f0b525f63 Change-Id: I77641b69f2573fc895a27ec9da63c2d2ab6d7a4e
* | Fix getting wrong instance when restoring non-configGeorge Mount2017-03-291-1/+9
| | | | | | | | | | | | | | | | | | | | | | Bug 36679897 When restoring the non-config fragments, the wrong index was being used to lookup the fragment fromt the list of active fragment states. Test: Ic862fd9670408dab09ab5817cdec21e91aef001b Change-Id: Ic5a8e723041949e6d01d4f5ddc6d54e491143b59
* | Make public getFragments() and onGetLayoutInflater() methodsGeorge Mount2017-03-291-7/+39
|/ | | | | | Bug 34703669 Test: I846ef668e3dd7d664cfb56d2b9400467ba9b79f4 Change-Id: Ie202960ada86b25e964f98a639b5f5740c8fdb79
* Revert "Make public getFragments() and onGetLayoutInflater() methods"Jeff Tinker2017-03-291-38/+7
| | | | | | | | | This reverts commit 599be3d01ed1811ae365085e67a15d082170b583. This change is being reverted because it broke git_master build. Change-Id: I54ab9cd3d9e08dcf870f472fda08cc44e57986d0 bug: 34703669
* Make public getFragments() and onGetLayoutInflater() methodsGeorge Mount2017-03-281-7/+38
| | | | | | | Bug 34703669 Test: I71856306a7bb67aacb84be17165e7e095653c20a Change-Id: I41999d0f5e6d75afebbbf67ad5bf49fa0cca509e
* Do not reuse fragment indices.George Mount2017-03-231-57/+54
| | | | | | | | | | | | Bug 25472591 Use a SparseArray instead of two ArrayLists to track active fragments. This allows monotonically increasing indexes instead of reusing indexes in the ArrayList. Test: ran cts tests Change-Id: I98f1b7928a0ef2373b719b76582a4c6da3425817
* Allow dangerous reentrant behavior for older appsGeorge Mount2017-03-151-25/+54
| | | | | | | | | | | Bug 36140114 Older apps may not be disciplined and could be taking advantage of the previous behavior that allowed executePendingTransactions() during FragmentManager state changes. Test: ran fragment cts tests Change-Id: I22e8979615f4cf78e1594d34fbfa72c9c49cf607