134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda/*
234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * Copyright (C) 2010 The Android Open Source Project
334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *
434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * Licensed under the Apache License, Version 2.0 (the "License");
534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * you may not use this file except in compliance with the License.
634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * You may obtain a copy of the License at
734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *
834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *      http://www.apache.org/licenses/LICENSE-2.0
934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *
1034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * Unless required by applicable law or agreed to in writing, software
1134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * distributed under the License is distributed on an "AS IS" BASIS,
1234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * See the License for the specific language governing permissions and
1434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * limitations under the License.
1534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda */
1634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
1734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerdapackage com.android.contacts.interactions;
1834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
1937a2684d1e47f6d78d757c437a187548f242ee13Flavio Lerdaimport com.google.common.annotations.VisibleForTesting;
2037a2684d1e47f6d78d757c437a187548f242ee13Flavio Lerda
2134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerdaimport android.app.Activity;
2234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerdaimport android.app.LoaderManager;
2334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerdaimport android.content.AsyncTaskLoader;
2434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerdaimport android.content.Loader;
2534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerdaimport android.os.Bundle;
2634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerdaimport android.util.Log;
2734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
2834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerdaimport java.io.FileDescriptor;
2934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerdaimport java.io.PrintWriter;
3034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerdaimport java.util.ArrayList;
3134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerdaimport java.util.HashSet;
3234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerdaimport java.util.List;
3334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
3434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerdaimport junit.framework.Assert;
3534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
3634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda/**
3734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * A {@link LoaderManager} that records which loaders have been completed.
3834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * <p>
3934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * You should wrap the existing LoaderManager with an instance of this class, which will then
4034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * delegate to the original object.
4134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * <p>
4234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * Typically, one would override {@link Activity#getLoaderManager()} to return the
4334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * TestLoaderManager and ensuring it wraps the {@link LoaderManager} for this object, e.g.:
4434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * <pre>
4534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *   private TestLoaderManager mTestLoaderManager;
4634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *
4734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *   public LoaderManager getLoaderManager() {
4834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *     LoaderManager loaderManager = super.getLoaderManager();
4934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *     if (mTestLoaderManager != null) {
5034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *       mTestLoaderManager.setDelegate(loaderManager);
5134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *       return mTestLoaderManager;
5234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *     } else {
5334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *       return loaderManager;
5434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *     }
5534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *   }
5634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *
5734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *   void setTestLoaderManager(TestLoaderManager testLoaderManager) {
5834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *     mTestLoaderManager = testLoaderManager;
5934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *   }
6034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * </pre>
6134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * In the tests, one would set the TestLoaderManager upon creating the activity, and then wait for
6234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * the loader to complete.
6334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * <pre>
6434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *   public void testLoadedCorrect() {
6534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *     TestLoaderManager testLoaderManager = new TestLoaderManager();
6634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *     getActivity().setTestLoaderManager(testLoaderManager);
6734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *     runOnUiThread(new Runnable() { public void run() { getActivity().startLoading(); } });
6834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *     testLoaderManager.waitForLoader(R.id.test_loader_id);
6934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *   }
7034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * </pre>
7134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * If the loader completes before the call to {@link #waitForLoaders(int...)}, the TestLoaderManager
7234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * will have stored the fact that the loader has completed and correctly terminate immediately.
7334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * <p>
7434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * It one needs to wait for the same loader multiple times, call {@link #reset()} between the them
7534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * as in:
7634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * <pre>
7734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *   public void testLoadedCorrect() {
7834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *     TestLoaderManager testLoaderManager = new TestLoaderManager();
7934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *     getActivity().setTestLoaderManager(testLoaderManager);
8034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *     runOnUiThread(new Runnable() { public void run() { getActivity().startLoading(); } });
8134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *     testLoaderManager.waitForLoader(R.id.test_loader_id);
8234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *     testLoaderManager.reset();
8334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *     // Load and wait again.
8434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *     runOnUiThread(new Runnable() { public void run() { getActivity().startLoading(); } });
8534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *     testLoaderManager.waitForLoader(R.id.test_loader_id);
8634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda *   }
8734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda * </pre>
8834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda */
8934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerdapublic class TestLoaderManager extends LoaderManager {
9034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    private static final String TAG = "TestLoaderManager";
9134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
9234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    private final HashSet<Integer> mFinishedLoaders;
9334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
9434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    private LoaderManager mDelegate;
9534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
9634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    public TestLoaderManager() {
9734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        mFinishedLoaders = new HashSet<Integer>();
9834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    }
9934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
10034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    /**
10134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda     * Sets the object to which we delegate the actual work.
10234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda     * <p>
10334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda     * It can not be set to null. Once set, it cannot be changed (but it allows setting it to the
10434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda     * same value again).
10534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda     */
10634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    public void setDelegate(LoaderManager delegate) {
10734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        if (delegate == null || (mDelegate != null && mDelegate != delegate)) {
10834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            throw new IllegalArgumentException("TestLoaderManager cannot be shared");
10934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        }
11034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
11134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        mDelegate = delegate;
11234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    }
11334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
11434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    public LoaderManager getDelegate() {
11534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        return mDelegate;
11634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    }
11734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
11834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    public void reset() {
11934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        mFinishedLoaders.clear();
12034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    }
12134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
12234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    /**
12334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda     * Waits for the specified loaders to complete loading.
12434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda     * <p>
12534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda     * If one of the loaders has already completed since the last call to {@link #reset()}, it will
12634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda     * not wait for it to complete again.
12734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda     */
12837a2684d1e47f6d78d757c437a187548f242ee13Flavio Lerda    @VisibleForTesting
12937a2684d1e47f6d78d757c437a187548f242ee13Flavio Lerda    /*package*/ synchronized void waitForLoaders(int... loaderIds) {
13034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        List<Loader<?>> loaders = new ArrayList<Loader<?>>(loaderIds.length);
13134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        for (int loaderId : loaderIds) {
13234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            if (mFinishedLoaders.contains(loaderId)) {
13334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                // This loader has already completed since the last reset, do not wait for it.
13434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                continue;
13534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            }
13634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
13734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            final AsyncTaskLoader<?> loader =
13834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                    (AsyncTaskLoader<?>) mDelegate.getLoader(loaderId);
13934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            if (loader == null) {
14034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                Assert.fail("Loader does not exist: " + loaderId);
14134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                return;
14234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            }
14334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
14434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            loaders.add(loader);
14534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        }
14634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
14734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        waitForLoaders(loaders.toArray(new Loader<?>[0]));
14834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    }
14934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
15034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    /**
15134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda     * Waits for the specified loaders to complete loading.
15234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda     */
15334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    public static void waitForLoaders(Loader<?>... loaders) {
15434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        // We want to wait for each loader using a separate thread, so that we can
15534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        // simulate race conditions.
15634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        Thread[] waitThreads = new Thread[loaders.length];
15734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        for (int i = 0; i < loaders.length; i++) {
15834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            final AsyncTaskLoader<?> loader = (AsyncTaskLoader<?>) loaders[i];
15934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            waitThreads[i] = new Thread("LoaderWaitingThread" + i) {
16034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                @Override
16134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                public void run() {
16234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                    try {
16334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                        loader.waitForLoader();
16434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                    } catch (Throwable e) {
16534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                        Log.e(TAG, "Exception while waiting for loader: " + loader.getId(), e);
16634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                        Assert.fail("Exception while waiting for loader: " + loader.getId());
16734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                    }
16834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                }
16934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            };
17034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            waitThreads[i].start();
17134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        }
17234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
17334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        // Now we wait for all these threads to finish
17434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        for (Thread thread : waitThreads) {
17534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            try {
17634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                thread.join();
17734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            } catch (InterruptedException e) {
17834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                // Ignore
17934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            }
18034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        }
18134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    }
18234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
18334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    @Override
18434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    public <D> Loader<D> initLoader(final int id, Bundle args, final LoaderCallbacks<D> callback) {
18534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        return mDelegate.initLoader(id, args, new LoaderManager.LoaderCallbacks<D>() {
18634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            @Override
18734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            public Loader<D> onCreateLoader(int id, Bundle args) {
18834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                return callback.onCreateLoader(id, args);
18934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            }
19034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
19134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            @Override
19234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            public void onLoadFinished(Loader<D> loader, D data) {
19334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                callback.onLoadFinished(loader, data);
19434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                synchronized (this) {
19534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                    mFinishedLoaders.add(id);
19634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                }
19734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            }
19834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
19934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            @Override
20034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            public void onLoaderReset(Loader<D> loader) {
20134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda                callback.onLoaderReset(loader);
20234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda            }
20334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        });
20434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    }
20534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
20634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    @Override
20734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    public <D> Loader<D> restartLoader(int id, Bundle args, LoaderCallbacks<D> callback) {
20834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        return mDelegate.restartLoader(id, args, callback);
20934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    }
21034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
21134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    @Override
21234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    public void destroyLoader(int id) {
21334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        mDelegate.destroyLoader(id);
21434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    }
21534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
21634ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    @Override
21734ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    public <D> Loader<D> getLoader(int id) {
21834ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        return mDelegate.getLoader(id);
21934ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    }
22034ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda
22134ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    @Override
22234ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
22334ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda        mDelegate.dump(prefix, fd, writer, args);
22434ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda    }
22534ce5e98f78b46b858d8afd450d1153c1d985426Flavio Lerda}
226