1180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell/* 2180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell * Copyright (C) 2016 The Android Open Source Project 3180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell * 4180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell * Licensed under the Apache License, Version 2.0 (the "License"); 5180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell * you may not use this file except in compliance with the License. 6180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell * You may obtain a copy of the License at 7180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell * 8180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell * http://www.apache.org/licenses/LICENSE-2.0 9180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell * 10180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell * Unless required by applicable law or agreed to in writing, software 11180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell * distributed under the License is distributed on an "AS IS" BASIS, 12180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell * See the License for the specific language governing permissions and 14180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell * limitations under the License. 15180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell */ 16180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 17180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 18180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powellpackage android.app; 19180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 20180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powellimport android.content.Context; 21180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powellimport android.os.Handler; 22180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powellimport android.os.Parcelable; 23180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powellimport android.support.test.filters.MediumTest; 24180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powellimport android.support.test.rule.ActivityTestRule; 25180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powellimport android.support.test.runner.AndroidJUnit4; 26180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powellimport android.util.ArrayMap; 27180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powellimport org.junit.Rule; 28180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powellimport org.junit.Test; 29180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powellimport org.junit.runner.RunWith; 30180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 31180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powellimport static junit.framework.TestCase.assertNotNull; 32180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powellimport static junit.framework.TestCase.assertNotSame; 33180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powellimport static junit.framework.TestCase.assertSame; 34180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 35180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell@RunWith(AndroidJUnit4.class) 36180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powellpublic class LoaderLifecycleTest { 37180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell @Rule 38180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell public ActivityTestRule<EmptyActivity> mActivityRule = 39180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell new ActivityTestRule<>(EmptyActivity.class); 40180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell @Test 41180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell @MediumTest 42180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell public void loaderIdentityTest() throws Throwable{ 43180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell mActivityRule.runOnUiThread(() -> { 44180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final Handler h = new Handler(); 45180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final FragmentController fc1 = FragmentController.createController( 46180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell new TestFragmentHostCallback(mActivityRule.getActivity(), h, 0)); 47180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 48180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.attachHost(null); 49180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.dispatchCreate(); 50180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 51180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final FragmentManager fm1 = fc1.getFragmentManager(); 52180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 53180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final Fragment f1 = new Fragment(); 54180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fm1.beginTransaction().add(f1, "one").commitNow(); 55180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 56180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell // Removing and re-adding a fragment completely will destroy its LoaderManager. 57180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell // Keep the first one here to confirm this later. 58180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final LoaderManager lm1 = f1.getLoaderManager(); 59180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 60180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell // Remove the fragment, add a second one, and re-add the first to 61180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell // force its internal index to change. The tests below should still remain consistent. 62180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final Fragment f2 = new Fragment(); 63180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fm1.beginTransaction().remove(f1).commitNow(); 64180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fm1.beginTransaction().add(f2, "two").commitNow(); 65180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fm1.beginTransaction().add(f1, "one").commitNow(); 66180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 67180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell // We'll check this to see if we get the same instance back later 68180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell // as passed through NonConfigurationInstance. If the keys stay consistent 69180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell // across fragment remove/re-add, this will be consistent. 70180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final LoaderManager lm12 = f1.getLoaderManager(); 71180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 72180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell assertNotSame("fully removed and re-added fragment got same LoaderManager", lm1, lm12); 73180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 74180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.dispatchActivityCreated(); 75180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.noteStateNotSaved(); 76180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.execPendingActions(); 77180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.doLoaderStart(); 78180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.dispatchStart(); 79180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.reportLoaderStart(); 80180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.dispatchResume(); 81180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.execPendingActions(); 82180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 83180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell // Bring the state back down to destroyed, simulating an activity restart 84180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.dispatchPause(); 85180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final Parcelable savedState = fc1.saveAllState(); 86180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.doLoaderStop(true); 87180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.dispatchStop(); 88180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final FragmentManagerNonConfig nonconf = fc1.retainNestedNonConfig(); 89180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 90180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final ArrayMap<String, LoaderManager> loaderNonConfig = fc1.retainLoaderNonConfig(); 91180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell assertNotNull("loaderNonConfig was null", loaderNonConfig); 92180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 93180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.dispatchDestroy(); 94180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 95180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell // Create the new controller and restore state 96180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final FragmentController fc2 = FragmentController.createController( 97180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell new TestFragmentHostCallback(mActivityRule.getActivity(), h, 0)); 98180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 99180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final FragmentManager fm2 = fc2.getFragmentManager(); 100180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 101180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.attachHost(null); 102100ba76d7a45847ffd3ecb1d468c91c0d0652032Adam Powell // Make sure nothing blows up on a null here 103100ba76d7a45847ffd3ecb1d468c91c0d0652032Adam Powell fc2.restoreLoaderNonConfig(null); 104100ba76d7a45847ffd3ecb1d468c91c0d0652032Adam Powell // for real this time 105180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.restoreLoaderNonConfig(loaderNonConfig); 106180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.restoreAllState(savedState, nonconf); 107180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.dispatchCreate(); 108180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 109180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 110180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.dispatchActivityCreated(); 111180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.noteStateNotSaved(); 112180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.execPendingActions(); 113180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.doLoaderStart(); 114180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.dispatchStart(); 115180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.reportLoaderStart(); 116180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.dispatchResume(); 117180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.execPendingActions(); 118180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 119180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell // Test that the fragments are in the configuration we expect 120180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final Fragment restoredOne = fm2.findFragmentByTag("one"); 121180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final LoaderManager lm2 = restoredOne.getLoaderManager(); 122180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 123180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell assertSame("didn't get same LoaderManager instance back", lm2, lm12); 124180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 125180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell // Bring the state back down to destroyed before we finish the test 126180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.dispatchPause(); 127180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.saveAllState(); 128180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.dispatchStop(); 129180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.dispatchDestroy(); 130180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell }); 131180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell } 132180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 133180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell @Test 134180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell @MediumTest 135180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell public void backStackLoaderIdentityTest() throws Throwable{ 136180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell mActivityRule.runOnUiThread(() -> { 137180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final Handler h = new Handler(); 138180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final FragmentHostCallback host1 = 139180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell new TestFragmentHostCallback(mActivityRule.getActivity(), h, 0); 140180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final FragmentController fc1 = FragmentController.createController(host1); 141180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 142180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.attachHost(null); 143180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.dispatchCreate(); 144180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 145180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final FragmentManager fm1 = fc1.getFragmentManager(); 146180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 147180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final Fragment f1 = new Fragment(); 148180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fm1.beginTransaction().add(f1, "one").commitNow(); 149180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 150180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final LoaderManager lm1 = f1.getLoaderManager(); 151180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 152180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell // Put the fragment on the back stack. 153180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fm1.beginTransaction().remove(f1).addToBackStack("backentry").commit(); 154180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fm1.executePendingTransactions(); 155180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 156180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.dispatchActivityCreated(); 157180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.noteStateNotSaved(); 158180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.execPendingActions(); 159180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.doLoaderStart(); 160180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.dispatchStart(); 161180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.reportLoaderStart(); 162180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.dispatchResume(); 163180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.execPendingActions(); 164180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 165180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell // Bring the state back down to destroyed, simulating an activity restart 166180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.dispatchPause(); 167180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final Parcelable savedState = fc1.saveAllState(); 168180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.doLoaderStop(true); 169180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.dispatchStop(); 170180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final FragmentManagerNonConfig nonconf = fc1.retainNestedNonConfig(); 171180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 172180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final ArrayMap<String, LoaderManager> loaderNonConfig = fc1.retainLoaderNonConfig(); 173180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell assertNotNull("loaderNonConfig was null", loaderNonConfig); 174180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 175180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc1.dispatchDestroy(); 176180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 177180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell // Create the new controller and restore state 178180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final FragmentHostCallback host2 = 179180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell new TestFragmentHostCallback(mActivityRule.getActivity(), h, 0); 180180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final FragmentController fc2 = FragmentController.createController(host2); 181180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 182180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final FragmentManager fm2 = fc2.getFragmentManager(); 183180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 184180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.attachHost(null); 185180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.restoreLoaderNonConfig(loaderNonConfig); 186180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.restoreAllState(savedState, nonconf); 187180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.dispatchCreate(); 188180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 189180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 190180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.dispatchActivityCreated(); 191180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.noteStateNotSaved(); 192180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.execPendingActions(); 193180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.doLoaderStart(); 194180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.dispatchStart(); 195180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.reportLoaderStart(); 196180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.dispatchResume(); 197180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.execPendingActions(); 198180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 199180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell assertNotSame("LoaderManager kept reference to old FragmentHostCallback", 200180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell host1, lm1.getFragmentHostCallback()); 201180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell assertSame("LoaderManager did not refrence new FragmentHostCallback", 202180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell host2, lm1.getFragmentHostCallback()); 203180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 204180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell // Test that the fragments are in the configuration we expect 205180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final Fragment restoredOne = fm2.findFragmentByTag("one"); 206180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell final LoaderManager lm2 = restoredOne.getLoaderManager(); 207180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 208180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell assertSame("didn't get same LoaderManager instance back", lm2, lm1); 209180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 210180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell // Bring the state back down to destroyed before we finish the test 211180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.dispatchPause(); 212180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.saveAllState(); 213180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.dispatchStop(); 214180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell fc2.dispatchDestroy(); 215180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell }); 216180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell } 217180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 218180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell public class TestFragmentHostCallback extends FragmentHostCallback<LoaderLifecycleTest> { 219180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell public TestFragmentHostCallback(Context context, Handler handler, int windowAnimations) { 220180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell super(context, handler, windowAnimations); 221180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell } 222180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell 223180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell @Override 224180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell public LoaderLifecycleTest onGetHost() { 225180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell return LoaderLifecycleTest.this; 226180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell } 227180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell } 228180202f2211d8c6bbb7a7057e61dafc90fe31930Adam Powell} 229