Disable Move Actions for POP3 Folders

Bug: 11311812
Change-Id: I5813281cca76b9b4a373b5b40dbbd1909800f951
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index a438b1b..322934c 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -40,6 +40,7 @@
         <attr name="usesAutodiscover" format="boolean"/>
         <attr name="offerLookback" format="boolean"/>
         <attr name="offerLoadMore" format="boolean"/>
+        <attr name="offerMoveTo" format="boolean"/>
         <attr name="defaultLookback">
             <enum name="auto" value="-2"/>
             <enum name="days1" value="1"/>
diff --git a/res/xml/services.xml b/res/xml/services.xml
index 096f81a..2d7446a 100644
--- a/res/xml/services.xml
+++ b/res/xml/services.xml
@@ -64,6 +64,7 @@
         email:offerLocalDeletes="true"
         email:inferPrefix="pop"
         email:offerLoadMore="true"
+        email:offerMoveTo="false"
          />
     <emailservice
         email:protocol="imap"
@@ -83,6 +84,7 @@
         email:syncChanges="true"
         email:inferPrefix="imap"
         email:offerLoadMore="true"
+        email:offerMoveTo="true"
          />
     <emailservice
         email:protocol="@string/protocol_eas"
@@ -105,5 +107,6 @@
         email:defaultLookback="auto"
         email:syncContacts="true"
         email:syncCalendar="true"
+        email:offerMoveTo="true"
          />
 </emailservices>
diff --git a/src/com/android/email/provider/EmailProvider.java b/src/com/android/email/provider/EmailProvider.java
index 1ffefda..e03e4c1 100644
--- a/src/com/android/email/provider/EmailProvider.java
+++ b/src/com/android/email/provider/EmailProvider.java
@@ -2832,7 +2832,7 @@
         return sb.toString();
     }
 
-    private static int getFolderCapabilities(EmailServiceInfo info, int type, long mailboxId) {
+    private int getFolderCapabilities(EmailServiceInfo info, int type, long mailboxId) {
         // Special case for Search folders: only permit delete, do not try to give any other caps.
         if (type == Mailbox.TYPE_SEARCH) {
             return UIProvider.FolderCapabilities.DELETE;
@@ -2865,6 +2865,12 @@
         if (isVirtualMailbox(mailboxId)) {
             caps |= UIProvider.FolderCapabilities.IS_VIRTUAL;
         }
+
+        if (!info.offerMoveTo) {
+            caps &= ~UIProvider.FolderCapabilities.CAN_ACCEPT_MOVED_MESSAGES &
+                    ~UIProvider.FolderCapabilities.ALLOWS_REMOVE_CONVERSATION &
+                    ~UIProvider.FolderCapabilities.ALLOWS_MOVE_TO_INBOX;
+        }
         return caps;
     }
 
diff --git a/src/com/android/email/service/EmailServiceUtils.java b/src/com/android/email/service/EmailServiceUtils.java
index 1122bad..c9b083b 100644
--- a/src/com/android/email/service/EmailServiceUtils.java
+++ b/src/com/android/email/service/EmailServiceUtils.java
@@ -201,6 +201,7 @@
         public int defaultSyncInterval;
         public String inferPrefix;
         public boolean offerLoadMore;
+        public boolean offerMoveTo;
         public boolean requiresSetup;
         public boolean hide;
 
@@ -576,6 +577,8 @@
                         info.inferPrefix = ta.getString(R.styleable.EmailServiceInfo_inferPrefix);
                         info.offerLoadMore =
                                 ta.getBoolean(R.styleable.EmailServiceInfo_offerLoadMore, false);
+                        info.offerMoveTo =
+                                ta.getBoolean(R.styleable.EmailServiceInfo_offerMoveTo, false);
                         info.requiresSetup =
                                 ta.getBoolean(R.styleable.EmailServiceInfo_requiresSetup, false);