Fixing ContactBrowserActivityTest
Change-Id: Ie492eae15c7163d0f8a3577e73ae14b786709a35
diff --git a/src/com/android/contacts/ContactsActivity.java b/src/com/android/contacts/ContactsActivity.java
index 913bc4c..90a975f 100644
--- a/src/com/android/contacts/ContactsActivity.java
+++ b/src/com/android/contacts/ContactsActivity.java
@@ -16,13 +16,32 @@
package com.android.contacts;
+import com.android.contacts.test.InjectedServices;
+
import android.app.Activity;
+import android.content.ContentResolver;
/**
* A common superclass for Contacts activities that handles application-wide services.
*/
public abstract class ContactsActivity extends Activity {
+ private ContentResolver mContentResolver;
+
+ @Override
+ public ContentResolver getContentResolver() {
+ if (mContentResolver == null) {
+ InjectedServices services = ContactsApplication.getInjectedServices();
+ if (services != null) {
+ mContentResolver = services.getContentResolver();
+ }
+ if (mContentResolver == null) {
+ mContentResolver = super.getContentResolver();
+ }
+ }
+ return mContentResolver;
+ }
+
@Override
public Object getSystemService(String name) {
Object service = super.getSystemService(name);