From bb822ca7cc0a5b67b67cc0924507ecc619a5aece Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Tue, 24 Aug 2010 11:04:58 -0700 Subject: [PATCH] Revert "Convert Controller to a full service" This reverts commit 0e6d972641c19467d6b26351ce14a3f44c9fd6f4. (It's a clean revert. Submitting for mblank, who had troubles with repo.) Change-Id: I843169f5dc3aff528c249035b3413b56ca552923 --- AndroidManifest.xml | 5 +- src/com/android/email/Controller.java | 65 +++++++++++-------- src/com/android/email/Email.java | 18 +++-- src/com/android/email/RefreshManager.java | 4 +- .../email/activity/AccountFolderList.java | 8 +-- .../activity/AccountFolderListFragment.java | 8 +-- .../email/activity/ActivityHelper.java | 2 +- src/com/android/email/activity/Debug.java | 2 +- .../android/email/activity/MailboxFinder.java | 2 +- .../android/email/activity/MailboxList.java | 8 +-- .../email/activity/MessageCompose.java | 2 +- .../android/email/activity/MessageList.java | 7 +- .../email/activity/MessageListFragment.java | 8 +-- .../email/activity/MessageViewBase.java | 6 +- .../activity/MessageViewFragmentBase.java | 2 +- .../android/email/service/MailService.java | 4 +- .../service/PopImapSyncAdapterService.java | 2 +- .../email/ControllerProviderOpsTests.java | 6 +- .../com/android/email/RefreshManagerTest.java | 8 +-- .../email/activity/MailboxFinderTest.java | 6 +- .../email/service/MailServiceTests.java | 2 +- 21 files changed, 97 insertions(+), 78 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 47afa28c7..305e36a81 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -277,10 +277,9 @@ > - - --> diff --git a/src/com/android/email/Controller.java b/src/com/android/email/Controller.java index 014f76630..7f6cdece9 100644 --- a/src/com/android/email/Controller.java +++ b/src/com/android/email/Controller.java @@ -16,7 +16,6 @@ package com.android.email; -import com.android.email.activity.Debug; import com.android.email.mail.AuthenticationFailedException; import com.android.email.mail.MessagingException; import com.android.email.mail.Store; @@ -34,7 +33,6 @@ import com.android.email.provider.EmailContent.MessageColumns; import com.android.email.service.EmailServiceStatus; import com.android.email.service.IEmailService; import com.android.email.service.IEmailServiceCallback; -import com.android.email.service.MailService; import android.app.Service; import android.content.ContentResolver; @@ -66,9 +64,9 @@ import java.util.concurrent.ConcurrentHashMap; public class Controller extends Service { private static final String TAG = "Controller"; private static Controller sInstance; - private Context mContext; + private final Context mContext; private Context mProviderContext; - private MessagingController mLegacyController; + private final MessagingController mLegacyController; private final LegacyListener mLegacyListener = new LegacyListener(); private final ServiceCallback mServiceCallback = new ServiceCallback(); private final HashSet mListeners = new HashSet(); @@ -107,31 +105,11 @@ public class Controller extends Service { private static RemoteCallbackList sCallbackList = new RemoteCallbackList(); - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - sInstance = this; - mContext = getApplicationContext(); - mProviderContext = mContext; + protected Controller(Context _context) { + mContext = _context.getApplicationContext(); + mProviderContext = _context; mLegacyController = MessagingController.getInstance(mProviderContext, this); mLegacyController.addListener(mLegacyListener); - // Tie MailRefreshManager to the Controller. - RefreshManager.getInstance(this); - // Reset all accounts to default visible window - resetVisibleLimits(); - // Enable logging in the EAS service, so it starts up as early as possible. - Debug.updateLoggingFlags(this); - MailService.actionReschedule(this); - return 0; - } - - @Override - public void onDestroy() { - sInstance = null; - Log.d(TAG, "Controller.onDestroy()"); - } - - public static Controller getInstance() { - return sInstance; } /** @@ -144,6 +122,39 @@ public class Controller extends Service { mLegacyController.removeListener(mLegacyListener); } + /** + * As a Service, Controller needs this no-argument constructor, but only because there is + * another constructor defined for the class. In the typical case for a Service, there are + * no defined constructors, so the default constructor is used when the Service is instantiated + * by ServiceManager (initialization would be performed in onCreate or onStartCommand, etc.) + * + * Because of this, the Controller Service, when bound, creates a second instance of the class, + * i.e. in addition to the "singleton" created/returned by getInstance. This is unfortunate, + * but not disruptive, as the Service Controller instance references members of sInstance (the + * previously-singleton Controller); it's perhaps best to think of the Service instance as a + * delegate. + * + * TODO: Have Controller behave more like a real Service. This means that the lifecycle of + * the Service (and thus the singleton instance) should be managed by ServiceManager (as happens + * with AttachmentDownloadService and MailService), its initialization should be handled in + * onCreate(), etc. When this is done (and it should be relatively simple), we will be back + * to a true singleton + */ + public Controller() { + mContext = mProviderContext = this; + mLegacyController = null; + } + + /** + * Gets or creates the singleton instance of Controller. + */ + public synchronized static Controller getInstance(Context _context) { + if (sInstance == null) { + sInstance = new Controller(_context); + } + return sInstance; + } + /** * Inject a mock controller. Used only for testing. Affects future calls to getInstance(). * diff --git a/src/com/android/email/Email.java b/src/com/android/email/Email.java index 822999ee4..a7cfd20c9 100644 --- a/src/com/android/email/Email.java +++ b/src/com/android/email/Email.java @@ -17,6 +17,7 @@ package com.android.email; import com.android.email.activity.AccountShortcutPicker; +import com.android.email.activity.Debug; import com.android.email.activity.MessageCompose; import com.android.email.provider.EmailContent; import com.android.email.service.AttachmentDownloadService; @@ -28,9 +29,11 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.database.Cursor; +import android.text.format.DateUtils; import android.util.Log; import java.io.File; +import java.util.HashMap; public class Email extends Application { public static final String LOG_TAG = "Email"; @@ -263,11 +266,7 @@ public class Email extends Application { * And now if accounts do exist then we've just enabled the service and we want to * schedule alarms for the new accounts. */ - // If this is running at start-up, Controller might not be running as a Service yet - // In this case, ignore - when it starts, it will call MailService.actionReschedule() - if (Controller.getInstance() != null) { - MailService.actionReschedule(context); - } + MailService.actionReschedule(context); } // Start/stop the AttachmentDownloadService, depending on whether there are any accounts Intent intent = new Intent(context, AttachmentDownloadService.class); @@ -276,7 +275,6 @@ public class Email extends Application { } else { context.stopService(intent); } - context.startService(new Intent(context, Controller.class)); } @Override @@ -285,6 +283,14 @@ public class Email extends Application { Preferences prefs = Preferences.getPreferences(this); DEBUG = prefs.getEnableDebugLogging(); setTempDirectory(this); + + // Tie MailRefreshManager to the Controller. + RefreshManager.getInstance(this); + // Reset all accounts to default visible window + Controller.getInstance(this).resetVisibleLimits(); + + // Enable logging in the EAS service, so it starts up as early as possible. + Debug.updateLoggingFlags(this); } /** diff --git a/src/com/android/email/RefreshManager.java b/src/com/android/email/RefreshManager.java index 6ff419a03..ce4d0a1b4 100644 --- a/src/com/android/email/RefreshManager.java +++ b/src/com/android/email/RefreshManager.java @@ -17,8 +17,10 @@ package com.android.email; import com.android.email.mail.MessagingException; +import com.android.email.provider.EmailContent; import android.content.Context; +import android.database.Cursor; import android.os.Handler; import android.util.Log; @@ -151,7 +153,7 @@ public class RefreshManager { */ public static synchronized RefreshManager getInstance(Context context) { if (sInstance == null) { - sInstance = new RefreshManager(context, Controller.getInstance(), + sInstance = new RefreshManager(context, Controller.getInstance(context), Clock.INSTANCE, new Handler()); } return sInstance; diff --git a/src/com/android/email/activity/AccountFolderList.java b/src/com/android/email/activity/AccountFolderList.java index 50cb317ec..f3761744c 100644 --- a/src/com/android/email/activity/AccountFolderList.java +++ b/src/com/android/email/activity/AccountFolderList.java @@ -106,7 +106,7 @@ public class AccountFolderList extends Activity implements AccountFolderListFrag @Override public void onPause() { super.onPause(); - Controller.getInstance().removeResultCallback(mControllerCallback); + Controller.getInstance(getApplication()).removeResultCallback(mControllerCallback); } @Override @@ -117,7 +117,7 @@ public class AccountFolderList extends Activity implements AccountFolderListFrag getSystemService(Context.NOTIFICATION_SERVICE); notifMgr.cancel(1); - Controller.getInstance().addResultCallback(mControllerCallback); + Controller.getInstance(getApplication()).addResultCallback(mControllerCallback); // Exit immediately if the accounts list has changed (e.g. externally deleted) if (Email.getNotifyUiAccountsChanged()) { @@ -150,7 +150,7 @@ public class AccountFolderList extends Activity implements AccountFolderListFrag Toast.LENGTH_LONG).show(); } else { showProgressIcon(true); - Controller.getInstance().updateMailboxList(accountId); + Controller.getInstance(getApplication()).updateMailboxList(accountId); // TODO update the inbox too } } @@ -214,7 +214,7 @@ public class AccountFolderList extends Activity implements AccountFolderListFrag Account.CONTENT_URI, null, null); mListFragment.hideDeletingAccount(mSelectedContextAccount.mId); - Controller.getInstance().deleteAccount( + Controller.getInstance(AccountFolderList.this).deleteAccount( mSelectedContextAccount.mId); if (numAccounts == 1) { AccountSetupBasics.actionNewAccount(AccountFolderList.this); diff --git a/src/com/android/email/activity/AccountFolderListFragment.java b/src/com/android/email/activity/AccountFolderListFragment.java index f00a8b6e4..490d10982 100644 --- a/src/com/android/email/activity/AccountFolderListFragment.java +++ b/src/com/android/email/activity/AccountFolderListFragment.java @@ -38,14 +38,14 @@ import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.view.ContextMenu; +import android.view.ContextMenu.ContextMenuInfo; import android.view.MenuItem; import android.view.View; -import android.view.ContextMenu.ContextMenuInfo; import android.widget.AdapterView; +import android.widget.AdapterView.OnItemClickListener; import android.widget.CursorAdapter; import android.widget.ListAdapter; import android.widget.ListView; -import android.widget.AdapterView.OnItemClickListener; public class AccountFolderListFragment extends ListFragment implements OnItemClickListener, AccountsAdapter.Callback { @@ -139,7 +139,7 @@ public class AccountFolderListFragment extends ListFragment @Override public void onResume() { super.onResume(); - Controller.getInstance().addResultCallback(mControllerCallback); + Controller.getInstance(mActivity).addResultCallback(mControllerCallback); updateAccounts(); } @@ -149,7 +149,7 @@ public class AccountFolderListFragment extends ListFragment @Override public void onPause() { super.onPause(); - Controller.getInstance().removeResultCallback(mControllerCallback); + Controller.getInstance(mActivity).removeResultCallback(mControllerCallback); } /** diff --git a/src/com/android/email/activity/ActivityHelper.java b/src/com/android/email/activity/ActivityHelper.java index 65672b60a..60044992b 100644 --- a/src/com/android/email/activity/ActivityHelper.java +++ b/src/com/android/email/activity/ActivityHelper.java @@ -88,7 +88,7 @@ public final class ActivityHelper { } public static void deleteMessage(Activity activity, long messageId) { - Controller.getInstance().deleteMessage(messageId, -1); + Controller.getInstance(activity).deleteMessage(messageId, -1); Utility.showToast(activity, activity.getResources().getQuantityString(R.plurals.message_deleted_toast, 1)); } diff --git a/src/com/android/email/activity/Debug.java b/src/com/android/email/activity/Debug.java index 3933c98be..9b566761c 100644 --- a/src/com/android/email/activity/Debug.java +++ b/src/com/android/email/activity/Debug.java @@ -125,7 +125,7 @@ public class Debug extends Activity implements OnCheckedChangeListener { int exchangeLogging = prefs.getEnableExchangeLogging() ? Eas.DEBUG_EXCHANGE_BIT : 0; int fileLogging = prefs.getEnableExchangeFileLogging() ? Eas.DEBUG_FILE_BIT : 0; int debugBits = debugLogging | exchangeLogging | fileLogging; - Controller.getInstance().serviceLogging(debugBits); + Controller.getInstance(context).serviceLogging(debugBits); //EXCHANGE-REMOVE-SECTION-END } } diff --git a/src/com/android/email/activity/MailboxFinder.java b/src/com/android/email/activity/MailboxFinder.java index 45ed4298e..c1f8cf7da 100644 --- a/src/com/android/email/activity/MailboxFinder.java +++ b/src/com/android/email/activity/MailboxFinder.java @@ -66,7 +66,7 @@ public class MailboxFinder { throw new UnsupportedOperationException(); } mContext = context.getApplicationContext(); - mController = Controller.getInstance(); + mController = Controller.getInstance(context); mAccountId = accountId; mMailboxType = mailboxType; mCallback = callback; diff --git a/src/com/android/email/activity/MailboxList.java b/src/com/android/email/activity/MailboxList.java index 7913be1fc..b2097ae94 100644 --- a/src/com/android/email/activity/MailboxList.java +++ b/src/com/android/email/activity/MailboxList.java @@ -117,7 +117,7 @@ public class MailboxList extends Activity implements MailboxListFragment.Callbac if (result == null) { return; } - final String accountName = result[0]; + final String accountName = (String) result[0]; // accountName is null if account name can't be retrieved or query exception if (accountName == null) { // something is wrong with this account @@ -134,13 +134,13 @@ public class MailboxList extends Activity implements MailboxListFragment.Callbac @Override public void onPause() { super.onPause(); - Controller.getInstance().removeResultCallback(mControllerCallback); + Controller.getInstance(getApplication()).removeResultCallback(mControllerCallback); } @Override public void onResume() { super.onResume(); - Controller.getInstance().addResultCallback(mControllerCallback); + Controller.getInstance(getApplication()).addResultCallback(mControllerCallback); // Exit immediately if the accounts list has changed (e.g. externally deleted) if (Email.getNotifyUiAccountsChanged()) { @@ -211,7 +211,7 @@ public class MailboxList extends Activity implements MailboxListFragment.Callbac * Refresh the mailbox list */ private void onRefresh() { - Controller controller = Controller.getInstance(); + Controller controller = Controller.getInstance(getApplication()); showProgressIcon(true); mListFragment.onRefresh(); } diff --git a/src/com/android/email/activity/MessageCompose.java b/src/com/android/email/activity/MessageCompose.java index 79fe1f6b1..384369527 100644 --- a/src/com/android/email/activity/MessageCompose.java +++ b/src/com/android/email/activity/MessageCompose.java @@ -266,7 +266,7 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus setContentView(R.layout.message_compose); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.list_title); - mController = Controller.getInstance(); + mController = Controller.getInstance(getApplication()); initViews(); setDraftNeedsSaving(false); diff --git a/src/com/android/email/activity/MessageList.java b/src/com/android/email/activity/MessageList.java index b3c213c04..e2aaeb529 100644 --- a/src/com/android/email/activity/MessageList.java +++ b/src/com/android/email/activity/MessageList.java @@ -46,8 +46,8 @@ import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.animation.Animation; -import android.view.animation.AnimationUtils; import android.view.animation.Animation.AnimationListener; +import android.view.animation.AnimationUtils; import android.widget.Button; import android.widget.ProgressBar; import android.widget.TextView; @@ -69,7 +69,7 @@ public class MessageList extends Activity implements OnClickListener, private Button mDeleteButton; private TextView mErrorBanner; - private final Controller mController = Controller.getInstance(); + private final Controller mController = Controller.getInstance(getApplication()); private ControllerResultUiThreadWrapper mControllerCallback; private TextView mLeftTitle; @@ -386,7 +386,6 @@ public class MessageList extends Activity implements OnClickListener, * * @deprecated not used any longer. remove them. */ - @Deprecated public void onSelectionChanged() { showMultiPanel(mListFragment.getSelectedCount() > 0); } @@ -395,7 +394,6 @@ public class MessageList extends Activity implements OnClickListener, * @deprecated not used any longer. remove them. (with associated resources, strings, * members, etc) */ - @Deprecated private void updateFooterButtonNames () { // Show "unread_action" when one or more read messages are selected. if (mListFragment.doesSelectionContainReadMessage()) { @@ -416,7 +414,6 @@ public class MessageList extends Activity implements OnClickListener, * * @deprecated not used any longer. remove them. */ - @Deprecated private void showMultiPanel(boolean show) { if (show && mMultiSelectPanel.getVisibility() != View.VISIBLE) { mMultiSelectPanel.setVisibility(View.VISIBLE); diff --git a/src/com/android/email/activity/MessageListFragment.java b/src/com/android/email/activity/MessageListFragment.java index 920397ba0..4887edf3c 100644 --- a/src/com/android/email/activity/MessageListFragment.java +++ b/src/com/android/email/activity/MessageListFragment.java @@ -42,15 +42,15 @@ import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; -import android.view.ViewGroup; import android.view.View.OnClickListener; +import android.view.ViewGroup; import android.widget.AdapterView; +import android.widget.AdapterView.OnItemClickListener; +import android.widget.AdapterView.OnItemLongClickListener; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; -import android.widget.AdapterView.OnItemClickListener; -import android.widget.AdapterView.OnItemLongClickListener; import java.security.InvalidParameterException; import java.util.HashSet; @@ -161,7 +161,7 @@ public class MessageListFragment extends ListFragment } super.onCreate(savedInstanceState); mActivity = getActivity(); - mController = Controller.getInstance(); + mController = Controller.getInstance(mActivity); mRefreshManager = RefreshManager.getInstance(mActivity); mRefreshManager.registerListener(mRefreshListener); } diff --git a/src/com/android/email/activity/MessageViewBase.java b/src/com/android/email/activity/MessageViewBase.java index 513df2735..de316a9d6 100644 --- a/src/com/android/email/activity/MessageViewBase.java +++ b/src/com/android/email/activity/MessageViewBase.java @@ -20,7 +20,11 @@ import com.android.email.Controller; import android.app.Activity; import android.app.ProgressDialog; +import android.content.ActivityNotFoundException; +import android.content.Intent; +import android.net.Uri; import android.os.Bundle; +import android.provider.Browser; /** * Base class for {@link MessageView} and {@link MessageFileView}. @@ -62,7 +66,7 @@ public abstract class MessageViewBase extends Activity implements MessageViewFra mFetchAttachmentProgressDialog.setIndeterminate(true); mFetchAttachmentProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); - mController = Controller.getInstance(); + mController = Controller.getInstance(getApplication()); } @Override diff --git a/src/com/android/email/activity/MessageViewFragmentBase.java b/src/com/android/email/activity/MessageViewFragmentBase.java index 20716dbe1..97350835c 100644 --- a/src/com/android/email/activity/MessageViewFragmentBase.java +++ b/src/com/android/email/activity/MessageViewFragmentBase.java @@ -210,7 +210,7 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O mDateFormat = android.text.format.DateFormat.getDateFormat(mContext); // short format mTimeFormat = android.text.format.DateFormat.getTimeFormat(mContext); // 12/24 date format - mController = Controller.getInstance(); + mController = Controller.getInstance(mContext); } @Override diff --git a/src/com/android/email/service/MailService.java b/src/com/android/email/service/MailService.java index 35018a98f..d3a49af4c 100644 --- a/src/com/android/email/service/MailService.java +++ b/src/com/android/email/service/MailService.java @@ -206,7 +206,7 @@ public class MailService extends Service { this.mStartId = startId; String action = intent.getAction(); - mController = Controller.getInstance(); + mController = Controller.getInstance(this); mController.addResultCallback(mControllerCallback); mContentResolver = getContentResolver(); @@ -336,7 +336,7 @@ public class MailService extends Service { @Override public void onDestroy() { super.onDestroy(); - Controller.getInstance().removeResultCallback(mControllerCallback); + Controller.getInstance(getApplication()).removeResultCallback(mControllerCallback); // Unregister our account listener if (mAccountsUpdatedListener != null) { AccountManager.get(this).removeOnAccountsUpdatedListener(mAccountsUpdatedListener); diff --git a/src/com/android/email/service/PopImapSyncAdapterService.java b/src/com/android/email/service/PopImapSyncAdapterService.java index d62f85fdc..74a5ba4e4 100644 --- a/src/com/android/email/service/PopImapSyncAdapterService.java +++ b/src/com/android/email/service/PopImapSyncAdapterService.java @@ -96,7 +96,7 @@ public class PopImapSyncAdapterService extends Service { Mailbox.TYPE_INBOX); if (mailboxId > 0) { Log.d(TAG, "Starting manual sync for account " + emailAddress); - Controller.getInstance().updateMailbox(accountId, mailboxId); + Controller.getInstance(context).updateMailbox(accountId, mailboxId); } } } diff --git a/tests/src/com/android/email/ControllerProviderOpsTests.java b/tests/src/com/android/email/ControllerProviderOpsTests.java index 61b73c9f7..7b0994bdb 100644 --- a/tests/src/com/android/email/ControllerProviderOpsTests.java +++ b/tests/src/com/android/email/ControllerProviderOpsTests.java @@ -17,13 +17,13 @@ package com.android.email; import com.android.email.provider.EmailContent; -import com.android.email.provider.EmailProvider; -import com.android.email.provider.ProviderTestUtils; import com.android.email.provider.EmailContent.Account; import com.android.email.provider.EmailContent.Body; import com.android.email.provider.EmailContent.HostAuth; import com.android.email.provider.EmailContent.Mailbox; import com.android.email.provider.EmailContent.Message; +import com.android.email.provider.EmailProvider; +import com.android.email.provider.ProviderTestUtils; import android.content.Context; import android.net.Uri; @@ -72,7 +72,7 @@ public class ControllerProviderOpsTests extends ProviderTestCase2 public static class TestController extends Controller { protected TestController(Context providerContext, Context systemContext) { - super(); + super(systemContext); setProviderContext(providerContext); } } diff --git a/tests/src/com/android/email/RefreshManagerTest.java b/tests/src/com/android/email/RefreshManagerTest.java index 13d52db00..845a3148d 100644 --- a/tests/src/com/android/email/RefreshManagerTest.java +++ b/tests/src/com/android/email/RefreshManagerTest.java @@ -17,9 +17,9 @@ package com.android.email; import com.android.email.mail.MessagingException; +import com.android.email.provider.EmailContent.Account; import com.android.email.provider.EmailProvider; import com.android.email.provider.ProviderTestUtils; -import com.android.email.provider.EmailContent.Account; import android.content.Context; import android.test.InstrumentationTestCase; @@ -55,7 +55,7 @@ public class RefreshManagerTest extends InstrumentationTestCase { mClock = new MockClock(); mContext = getInstrumentation().getTargetContext(); - mController = new MockController(); + mController = new MockController(mContext); mListener = new RefreshListener(); mProviderContext = DBTestHelper.ProviderContextSetupHelper.getProviderContext( mContext, EmailProvider.class); @@ -474,8 +474,8 @@ public class RefreshManagerTest extends InstrumentationTestCase { public volatile boolean mCalledUpdateMailboxList; public volatile Result mListener; - protected MockController() { - super(); + protected MockController(Context context) { + super(context); } public void reset() { diff --git a/tests/src/com/android/email/activity/MailboxFinderTest.java b/tests/src/com/android/email/activity/MailboxFinderTest.java index 2c6e4d820..e26219505 100644 --- a/tests/src/com/android/email/activity/MailboxFinderTest.java +++ b/tests/src/com/android/email/activity/MailboxFinderTest.java @@ -22,10 +22,10 @@ import com.android.email.Email; import com.android.email.TestUtils; import com.android.email.mail.MessagingException; import com.android.email.provider.EmailContent; -import com.android.email.provider.EmailProvider; -import com.android.email.provider.ProviderTestUtils; import com.android.email.provider.EmailContent.Account; import com.android.email.provider.EmailContent.Mailbox; +import com.android.email.provider.EmailProvider; +import com.android.email.provider.ProviderTestUtils; import android.content.Context; import android.test.InstrumentationTestCase; @@ -337,7 +337,7 @@ public class MailboxFinderTest extends InstrumentationTestCase { } protected MockController(Context context) { - super(); + super(context); } @Override diff --git a/tests/src/com/android/email/service/MailServiceTests.java b/tests/src/com/android/email/service/MailServiceTests.java index 31035bc08..713e3bdb1 100644 --- a/tests/src/com/android/email/service/MailServiceTests.java +++ b/tests/src/com/android/email/service/MailServiceTests.java @@ -163,7 +163,7 @@ public class MailServiceTests extends AccountTestCase { public static class TestController extends Controller { protected TestController(Context providerContext, Context systemContext) { - super(); + super(systemContext); setProviderContext(providerContext); } }