diff options
author | Raman Tenneti <rtenneti@google.com> | 2019-02-20 20:36:15 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-02-20 20:36:15 +0000 |
commit | 32b1ffe47dda053e15e3c792c0f9f92029b10d7e (patch) | |
tree | 7b8a70cba410feb9ace334b3b9cd6d5007b8bb24 | |
parent | 86350de194dd8b3ffe3e2c23af16043c6aeb2479 (diff) | |
parent | 01219ad190e29f1377c0b47f28b08f0594176c00 (diff) | |
download | UnifiedEmail-32b1ffe47dda053e15e3c792c0f9f92029b10d7e.tar.gz |
Merge "Revert "AOSP/Email - Bumped the targetSdkVersion to 28 (maximum version) in UnifiedEmail using JobIntentservice.""
-rw-r--r-- | AndroidManifest.xml | 2 | ||||
-rw-r--r-- | src/com/android/mail/MailIntentService.java | 17 | ||||
-rw-r--r-- | src/com/android/mail/browse/EmlMessageLoader.java | 2 | ||||
-rw-r--r-- | src/com/android/mail/browse/EmlTempFileDeletionService.java | 18 | ||||
-rw-r--r-- | src/com/android/mail/utils/NotificationActionUtils.java | 2 | ||||
-rw-r--r-- | src/com/android/mail/utils/NotificationUtils.java | 2 |
6 files changed, 16 insertions, 27 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 0c200c23a..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" diff --git a/src/com/android/mail/MailIntentService.java b/src/com/android/mail/MailIntentService.java index df8134ada..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); @@ -127,7 +124,7 @@ public class MailIntentService extends JobIntentService { public static void broadcastBackupDataChanged(final Context context) { final Intent intent = new Intent(ACTION_BACKUP_DATA_CHANGED); intent.setPackage(context.getPackageName()); - MailIntentService.enqueueWork(context, intent); + context.startService(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(); diff --git a/src/com/android/mail/utils/NotificationActionUtils.java b/src/com/android/mail/utils/NotificationActionUtils.java index 8f13deb16..b3935f62a 100644 --- a/src/com/android/mail/utils/NotificationActionUtils.java +++ b/src/com/android/mail/utils/NotificationActionUtils.java @@ -877,7 +877,7 @@ public class NotificationActionUtils { if (folder != null) { intent.putExtra(Utils.EXTRA_FOLDER_URI, folder.folderUri.fullUri); } - MailIntentService.enqueueWork(context, intent); + context.startService(intent); } public static void registerUndoNotificationObserver(final DataSetObserver observer) { diff --git a/src/com/android/mail/utils/NotificationUtils.java b/src/com/android/mail/utils/NotificationUtils.java index 896195378..7337b8c4e 100644 --- a/src/com/android/mail/utils/NotificationUtils.java +++ b/src/com/android/mail/utils/NotificationUtils.java @@ -483,7 +483,7 @@ public class NotificationUtils { intent.putExtra(Utils.EXTRA_ACCOUNT, account); intent.putExtra(Utils.EXTRA_FOLDER, folder); intent.putExtra(EXTRA_GET_ATTENTION, getAttention); - MailIntentService.enqueueWork(context, intent); + context.startService(intent); } /** |