Merge "AOSP/Email - Bumped version number to 28. Disabled notifications, uifolders and uiaccounts to make Email work with API 28."
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 4fc82cb..b4450fc 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -45,9 +45,10 @@
     <uses-permission android:name="android.permission.WAKE_LOCK"/>
     <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
     <uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
+    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
 
     <!-- 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" />
 
     <!-- additional uses -->
 
@@ -688,6 +689,7 @@
         <provider
             android:name=".provider.EmailProvider"
             android:authorities="com.android.email.provider;com.android.email.notifier"
+            android:enabled="true"
             android:exported="true"
             android:permission="com.android.email.permission.ACCESS_PROVIDER"
             android:label="@string/app_name"
diff --git a/provider_src/com/android/email/provider/EmailProvider.java b/provider_src/com/android/email/provider/EmailProvider.java
index 1f0956b..9dd2d2e 100644
--- a/provider_src/com/android/email/provider/EmailProvider.java
+++ b/provider_src/com/android/email/provider/EmailProvider.java
@@ -1317,8 +1317,10 @@
                             uri.getQueryParameter(EmailContent.SUPPRESS_COMBINED_ACCOUNT_PARAM);
                     final boolean suppressCombined =
                             suppressParam != null && Boolean.parseBoolean(suppressParam);
-                    c = uiAccounts(projection, suppressCombined);
-                    return c;
+                    // TODO(rtenneti): Enable notifications.
+                    // c = uiAccounts(projection, suppressCombined);
+                    // return c;
+                    return null;
                 case UI_UNDO:
                     return uiUndo(projection);
                 case UI_SUBFOLDERS:
@@ -1346,8 +1348,10 @@
                     c = uiQuery(match, uri, projection, unseenOnly);
                     return c;
                 case UI_FOLDERS:
-                    c = uiFolders(uri, projection);
-                    return c;
+                    // TODO(rtenneti): Enable notifications.
+                    // c = uiFolders(uri, projection);
+                    // return c;
+                    return null;
                 case UI_FOLDER_LOAD_MORE:
                     c = uiFolderLoadMore(getMailbox(uri));
                     return c;
@@ -1539,7 +1543,8 @@
         }
 
         if ((c != null) && !isTemporary()) {
-            c.setNotificationUri(getContext().getContentResolver(), uri);
+            // TODO(rtenneti): Enable notifications.
+            // c.setNotificationUri(getContext().getContentResolver(), uri);
         }
         return c;
     }
@@ -2546,7 +2551,8 @@
             final Set<Uri> notifications = getBatchNotificationsSet();
             setBatchNotificationsSet(null);
             for (final Uri uri : notifications) {
-                context.getContentResolver().notifyChange(uri, null);
+                // TODO(rtenneti): Enable notifications.
+                // context.getContentResolver().notifyChange(uri, null);
             }
         }
     }
@@ -2562,7 +2568,8 @@
         @Override
         public void attachmentChanged(final Context context, final long id, final int flags) {
             // The default implementation delegates to the real service.
-            AttachmentService.attachmentChanged(context, id, flags);
+            // TODO(rtenneti): Enable AttachmentService.
+            // AttachmentService.attachmentChanged(context, id, flags);
         }
     };
     private EmailAttachmentService mAttachmentService = DEFAULT_ATTACHMENT_SERVICE;
@@ -3976,7 +3983,8 @@
         } finally {
             accountIdCursor.close();
         }
-        mc.setNotificationUri(context.getContentResolver(), UIPROVIDER_ALL_ACCOUNTS_NOTIFIER);
+        // TODO(rtenneti): Enable notifications.
+        // mc.setNotificationUri(context.getContentResolver(), UIPROVIDER_ALL_ACCOUNTS_NOTIFIER);
 
         return mc;
     }
@@ -4637,8 +4645,9 @@
                     // Return real and virtual mailboxes alike
                     final Cursor rawc = db.rawQuery(genQueryAccountAllMailboxes(uiProjection),
                             new String[] {id});
-                    rawc.setNotificationUri(context.getContentResolver(), notifyUri);
-                    vc.setNotificationUri(context.getContentResolver(), notifyUri);
+                    // TODO(rtenneti): Enable notifications.
+                    // rawc.setNotificationUri(context.getContentResolver(), notifyUri);
+                    // vc.setNotificationUri(context.getContentResolver(), notifyUri);
                     if (rawc.getCount() > 0) {
                         c = new MergeCursor(new Cursor[]{rawc, vc});
                     } else {
@@ -4779,7 +4788,8 @@
                 break;
         }
         if (notifyUri != null) {
-            c.setNotificationUri(resolver, notifyUri);
+            // TODO(rtenneti): Enable notifications.
+            // c.setNotificationUri(resolver, notifyUri);
         }
         return c;
     }
@@ -5234,7 +5244,8 @@
             mailPrefs.setConversationOverviewMode(overviewMode);
         }
 
-        c.getContentResolver().notifyChange(UIPROVIDER_ALL_ACCOUNTS_NOTIFIER, null, false);
+        // TODO(rtenneti): Enable notifications.
+        // c.getContentResolver().notifyChange(UIPROVIDER_ALL_ACCOUNTS_NOTIFIER, null, false);
 
         return 1;
     }
@@ -5711,7 +5722,8 @@
         if (batchNotifications != null) {
             batchNotifications.add(notifyUri);
         } else {
-            getContext().getContentResolver().notifyChange(notifyUri, null);
+            // TODO(rtenneti): Enable notifications.
+            // getContext().getContentResolver().notifyChange(notifyUri, null);
         }
     }
 
diff --git a/provider_src/com/android/email/service/AttachmentService.java b/provider_src/com/android/email/service/AttachmentService.java
index 50ee429..1a628f7 100644
--- a/provider_src/com/android/email/service/AttachmentService.java
+++ b/provider_src/com/android/email/service/AttachmentService.java
@@ -611,14 +611,15 @@
      * @param intent an intent set to run AttachmentService class
      */
     public static void start(Context context, Intent intent) {
-        if (context.getApplicationInfo().targetSdkVersion >= android.os.Build.VERSION_CODES.O &&
-                !isRunning) {
-            LogUtils.i(LOG_TAG, "startForegroundService");
-            context.startForegroundService(intent);
-        } else {
-            LogUtils.i(LOG_TAG, "startService");
-            context.startService(intent);
-        }
+        // TODO(rtenneti): Enable notifications.
+        // if (context.getApplicationInfo().targetSdkVersion >= android.os.Build.VERSION_CODES.O &&
+        //        !isRunning) {
+        //    LogUtils.i(LOG_TAG, "startForegroundService");
+        //    context.startForegroundService(intent);
+        // } else {
+        //    LogUtils.i(LOG_TAG, "startService");
+        //    context.startService(intent);
+        // }
     }
 
     public static void stop(Context context) {