Prepare playback immediately, new BackgroundTaskService.
- Immediately we start the CallDetailActivity with a voicemail, do the
preparing of the media so we can see the duration.
- Use the duration text field to show "buffering..." until media source
is prepared.
- Do the preparing in the background, this fixes a strict mode
violation.
- If there's an error preparing, show an error message in that field.
- Add tests for both of the above cases.
BackgroundTaskService:
- Introduces new BackgroundTaskService, lightweight method for
submitting AsyncTask objects.
- Introduces BackgroundTask interface and simple AbstractBackgroundTask
abstract implementation.
- Adds BackgroundTaskService to ContactsApplication allowing Activity
objects to get hold of a regular background task service.
- Adds a MockBackgroundTaskService for use with injecting for test, so
that we can prevent or control processing of background tasks.
Other:
- Every time we resume the Activity, we were causing a new voicemail
fragment to be created. There was no bug tracking this, I just
noticed it because of occasionally flaky tests. Added a fix and test
to catch it again next time.
- Fixes missing tear down method in PeopleActivityTest.
Bug: 5115133
Bug: 5059965
Bug: 5114261
Bug: 5113695
Change-Id: Ia2469229fa756da8b3977231fbf23a9d3fb379ce
diff --git a/src/com/android/contacts/ContactsApplication.java b/src/com/android/contacts/ContactsApplication.java
index 1c8c080..1e791b6 100644
--- a/src/com/android/contacts/ContactsApplication.java
+++ b/src/com/android/contacts/ContactsApplication.java
@@ -18,6 +18,7 @@
import com.android.contacts.model.AccountTypeManager;
import com.android.contacts.test.InjectedServices;
+import com.android.contacts.util.BackgroundTaskService;
import com.google.common.annotations.VisibleForTesting;
import android.app.Application;
@@ -33,6 +34,7 @@
private static InjectedServices sInjectedServices;
private AccountTypeManager mAccountTypeManager;
private ContactPhotoManager mContactPhotoManager;
+ private BackgroundTaskService mBackgroundTaskService;
/**
* Overrides the system services with mocks for testing.
@@ -93,6 +95,13 @@
return mContactPhotoManager;
}
+ if (BackgroundTaskService.BACKGROUND_TASK_SERVICE.equals(name)) {
+ if (mBackgroundTaskService == null) {
+ mBackgroundTaskService = BackgroundTaskService.createBackgroundTaskService();
+ }
+ return mBackgroundTaskService;
+ }
+
return super.getSystemService(name);
}