DO NOT MERGE - Skip qt-dev-plus-aosp-without-vendor (5713463) in stage-aosp-master
Bug: 134405016
Change-Id: Iad997cb8695fb03ff7d5aa677d6970c791e3a73e
diff --git a/Android.mk b/Android.mk
index 45e64ff..ae10feb 100644
--- a/Android.mk
+++ b/Android.mk
@@ -32,8 +32,7 @@
androidx.appcompat_appcompat \
androidx.gridlayout_gridlayout \
androidx.legacy_legacy-support-v13 \
- android-opt-bitmap \
- android-opt-datetimepicker
+ android-opt-bitmap
LOCAL_STATIC_JAVA_LIBRARIES := \
androidx.annotation_annotation \
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 721ba1b..e34a4fc 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="24" android:minSdkVersion="14" />
+ <uses-sdk android:targetSdkVersion="28" android:minSdkVersion="14" />
<application
android:icon="@mipmap/ic_launcher_mail"
@@ -175,7 +175,9 @@
android:permission="android.permission.BIND_REMOTEVIEWS"
android:exported="false" />
<service android:name=".MailLogService"/>
- <service android:name=".browse.EmlTempFileDeletionService" />
+ <service android:name=".browse.EmlTempFileDeletionService"
+ android:permission="android.permission.BIND_JOB_SERVICE"
+ android:exported="true" />
</application>
diff --git a/src/com/android/mail/MailIntentService.java b/src/com/android/mail/MailIntentService.java
index 8151dfc..db7b99b 100644
--- a/src/com/android/mail/MailIntentService.java
+++ b/src/com/android/mail/MailIntentService.java
@@ -15,11 +15,12 @@
*/
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;
@@ -34,7 +35,7 @@
/**
* A service to handle various intents asynchronously.
*/
-public class MailIntentService extends IntentService {
+public class MailIntentService extends JobIntentService {
private static final String LOG_TAG = LogTag.getLogTag();
public static final String ACTION_RESEND_NOTIFICATIONS =
@@ -56,16 +57,18 @@
public static final String CONVERSATION_EXTRA = "conversation";
+ public static final int JOB_ID = 100;
+
public MailIntentService() {
- super("MailIntentService");
+ super();
}
- protected MailIntentService(final String name) {
- super(name);
+ public static void enqueueWork(Context context, Intent work) {
+ enqueueWork(context, MailIntentService.class, JOB_ID, work);
}
@Override
- protected void onHandleIntent(final Intent intent) {
+ protected void onHandleWork(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 82fa98f..acf7716 100644
--- a/src/com/android/mail/browse/EmlMessageLoader.java
+++ b/src/com/android/mail/browse/EmlMessageLoader.java
@@ -105,7 +105,7 @@
intent.setClass(getContext(), EmlTempFileDeletionService.class);
intent.setData(message.attachmentListUri);
- getContext().startService(intent);
+ EmlTempFileDeletionService.enqueueWork(getContext(), intent);
}
}
}
diff --git a/src/com/android/mail/browse/EmlTempFileDeletionService.java b/src/com/android/mail/browse/EmlTempFileDeletionService.java
index 71a915c..8a772c3 100644
--- a/src/com/android/mail/browse/EmlTempFileDeletionService.java
+++ b/src/com/android/mail/browse/EmlTempFileDeletionService.java
@@ -17,25 +17,33 @@
package com.android.mail.browse;
-import android.app.IntentService;
+import android.content.Context;
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 IntentService {
+public class EmlTempFileDeletionService extends JobIntentService {
+
+ public static final int JOB_ID = 101;
public EmlTempFileDeletionService() {
- super("EmlTempFileDeletionService");
+ super();
}
public EmlTempFileDeletionService(String name) {
- super(name);
+ super();
+ }
+
+ public static void enqueueWork(Context context, Intent work) {
+ enqueueWork(context, EmlTempFileDeletionService.class, JOB_ID, work);
}
@Override
- protected void onHandleIntent(Intent intent) {
+ protected void onHandleWork(Intent intent) {
final String action = intent.getAction();
if (Intent.ACTION_DELETE.equals(action)) {
final Uri uri = intent.getData();