Code example for RenamingDelegatingContext

Methods: makeExistingFilesAndDbsAccessible

0
                ai.packageName = "contactsTestPackage";
                return ai;
            } 
        }; 
        RenamingDelegatingContext targetContextWrapper =
                new RenamingDelegatingContext(context, targetContext, "perf.");
        targetContextWrapper.makeExistingFilesAndDbsAccessible();
        IsolatedContext providerContext = new IsolatedContext(resolver, targetContextWrapper);
        SynchronousContactsProvider2 provider = new SynchronousContactsProvider2();
        provider.setDataWipeEnabled(false);
        provider.attachInfo(providerContext, null);
        resolver.addProvider(ContactsContract.AUTHORITY, provider);
 
        long rawContactCount = provider.getRawContactCount();
        if (rawContactCount == 0) {
            Log.w(TAG, "The test has not been set up. Use this command to copy a contact db"
                    + " to the device:\nadb push <large contacts2.db> " 
                    + "data/data/com.android.providers.contacts/databases/perf.contacts2.db"); 
            return; 
        }