1/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18package android.app;
19
20import java.util.List;
21
22/**
23 * FragmentManagerNonConfig stores the retained instance fragments across
24 * activity recreation events.
25 *
26 * <p>Apps should treat objects of this type as opaque, returned by
27 * and passed to the state save and restore process for fragments in
28 * {@link FragmentController#retainNonConfig()} and
29 * {@link FragmentController#restoreAllState(Parcelable, FragmentManagerNonConfig)}.</p>
30 */
31public class FragmentManagerNonConfig {
32    private final List<Fragment> mFragments;
33    private final List<FragmentManagerNonConfig> mChildNonConfigs;
34
35    FragmentManagerNonConfig(List<Fragment> fragments,
36            List<FragmentManagerNonConfig> childNonConfigs) {
37        mFragments = fragments;
38        mChildNonConfigs = childNonConfigs;
39    }
40
41    /**
42     * @return the retained instance fragments returned by a FragmentManager
43     */
44    List<Fragment> getFragments() {
45        return mFragments;
46    }
47
48    /**
49     * @return the FragmentManagerNonConfigs from any applicable fragment's child FragmentManager
50     */
51    List<FragmentManagerNonConfig> getChildNonConfigs() {
52        return mChildNonConfigs;
53    }
54}
55