summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2019-06-26 20:38:19 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-06-26 20:38:19 +0000
commit7ffdac40ac88f18f7633e74065c1fa37f21bf484 (patch)
tree439defc6470c4b453f057b8da60123cec9b4075f
parentc7c9b11ad3f09297ed65f9229e5b9bc2609dc553 (diff)
parent20e45d84f9dc906034fb535ac35fb2a2ba9dc995 (diff)
downloadUnifiedEmail-7ffdac40ac88f18f7633e74065c1fa37f21bf484.tar.gz
Merge "Revert "AOSP/UnifiedEmail - Bumped the targetSdkVersion to 28 (maximum version). Used JobIntentservice API calls to replace context.startService.""
-rw-r--r--AndroidManifest.xml6
-rw-r--r--src/com/android/mail/MailIntentService.java15
-rw-r--r--src/com/android/mail/browse/EmlMessageLoader.java2
-rw-r--r--src/com/android/mail/browse/EmlTempFileDeletionService.java18
4 files changed, 14 insertions, 27 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index e34a4fc1d..721ba1b68 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -27,7 +27,7 @@
<uses-permission android:name="android.permission.NFC" />
<!-- This needs to be present when we are doing unbundled releases. -->
- <uses-sdk android:targetSdkVersion="28" android:minSdkVersion="14" />
+ <uses-sdk android:targetSdkVersion="24" android:minSdkVersion="14" />
<application
android:icon="@mipmap/ic_launcher_mail"
@@ -175,9 +175,7 @@
android:permission="android.permission.BIND_REMOTEVIEWS"
android:exported="false" />
<service android:name=".MailLogService"/>
- <service android:name=".browse.EmlTempFileDeletionService"
- android:permission="android.permission.BIND_JOB_SERVICE"
- android:exported="true" />
+ <service android:name=".browse.EmlTempFileDeletionService" />
</application>
diff --git a/src/com/android/mail/MailIntentService.java b/src/com/android/mail/MailIntentService.java
index db7b99b04..8151dfc28 100644
--- a/src/com/android/mail/MailIntentService.java
+++ b/src/com/android/mail/MailIntentService.java
@@ -15,12 +15,11 @@
*/
package com.android.mail;
+import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
-import androidx.core.app.JobIntentService;
-
import com.android.mail.analytics.Analytics;
import com.android.mail.photo.ContactFetcher;
import com.android.mail.providers.Account;
@@ -35,7 +34,7 @@ import com.android.mail.utils.Utils;
/**
* A service to handle various intents asynchronously.
*/
-public class MailIntentService extends JobIntentService {
+public class MailIntentService extends IntentService {
private static final String LOG_TAG = LogTag.getLogTag();
public static final String ACTION_RESEND_NOTIFICATIONS =
@@ -57,18 +56,16 @@ public class MailIntentService extends JobIntentService {
public static final String CONVERSATION_EXTRA = "conversation";
- public static final int JOB_ID = 100;
-
public MailIntentService() {
- super();
+ super("MailIntentService");
}
- public static void enqueueWork(Context context, Intent work) {
- enqueueWork(context, MailIntentService.class, JOB_ID, work);
+ protected MailIntentService(final String name) {
+ super(name);
}
@Override
- protected void onHandleWork(final Intent intent) {
+ protected void onHandleIntent(final Intent intent) {
// UnifiedEmail does not handle all Intents
LogUtils.v(LOG_TAG, "Handling intent %s", intent);
diff --git a/src/com/android/mail/browse/EmlMessageLoader.java b/src/com/android/mail/browse/EmlMessageLoader.java
index acf7716e4..82fa98f81 100644
--- a/src/com/android/mail/browse/EmlMessageLoader.java
+++ b/src/com/android/mail/browse/EmlMessageLoader.java
@@ -105,7 +105,7 @@ public class EmlMessageLoader extends MailAsyncTaskLoader<ConversationMessage> {
intent.setClass(getContext(), EmlTempFileDeletionService.class);
intent.setData(message.attachmentListUri);
- EmlTempFileDeletionService.enqueueWork(getContext(), intent);
+ getContext().startService(intent);
}
}
}
diff --git a/src/com/android/mail/browse/EmlTempFileDeletionService.java b/src/com/android/mail/browse/EmlTempFileDeletionService.java
index 8a772c3aa..71a915c51 100644
--- a/src/com/android/mail/browse/EmlTempFileDeletionService.java
+++ b/src/com/android/mail/browse/EmlTempFileDeletionService.java
@@ -17,33 +17,25 @@
package com.android.mail.browse;
-import android.content.Context;
+import android.app.IntentService;
import android.content.Intent;
import android.net.Uri;
-import androidx.core.app.JobIntentService;
-
/**
* {@link IntentService} that cleans up temporary files in the cache for the eml viewer.
*/
-public class EmlTempFileDeletionService extends JobIntentService {
-
- public static final int JOB_ID = 101;
+public class EmlTempFileDeletionService extends IntentService {
public EmlTempFileDeletionService() {
- super();
+ super("EmlTempFileDeletionService");
}
public EmlTempFileDeletionService(String name) {
- super();
- }
-
- public static void enqueueWork(Context context, Intent work) {
- enqueueWork(context, EmlTempFileDeletionService.class, JOB_ID, work);
+ super(name);
}
@Override
- protected void onHandleWork(Intent intent) {
+ protected void onHandleIntent(Intent intent) {
final String action = intent.getAction();
if (Intent.ACTION_DELETE.equals(action)) {
final Uri uri = intent.getData();