Enable selection action mode for Android M+.

Since I62963d225e6ea5d2ec9d8ebc8a6d73099f5d6c7f, we have disabled
selection action mode in the folder-name editing mode on Launcher,
mainly because it messed up the view on phones.  However that is no
longer the case in Android M and later, where floating action mode
is available.

With this CL, we start relying on the default floating action mode
in Android M and later.

Bug: 22210697
Change-Id: Ie19e7844194acd86cdb013254a1923f0b1d78e11
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index 93c3568..27572e3 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -210,8 +210,26 @@
         });
         mFolderName.setOnFocusChangeListener(this);
 
-        // We disable action mode for now since it messes up the view on phones
-        mFolderName.setCustomSelectionActionModeCallback(mActionModeCallback);
+        if (!Utilities.ATLEAST_MARSHMALLOW) {
+            // We disable action mode in older OSes where floating selection menu is not yet
+            // available.
+            mFolderName.setCustomSelectionActionModeCallback(new ActionMode.Callback() {
+                public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
+                    return false;
+                }
+
+                public boolean onCreateActionMode(ActionMode mode, Menu menu) {
+                    return false;
+                }
+
+                public void onDestroyActionMode(ActionMode mode) {
+                }
+
+                public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
+                    return false;
+                }
+            });
+        }
         mFolderName.setOnEditorActionListener(this);
         mFolderName.setSelectAllOnFocus(true);
         mFolderName.setInputType(mFolderName.getInputType() |
@@ -226,23 +244,6 @@
         mFooterHeight = mFooter.getMeasuredHeight();
     }
 
-    private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() {
-        public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
-            return false;
-        }
-
-        public boolean onCreateActionMode(ActionMode mode, Menu menu) {
-            return false;
-        }
-
-        public void onDestroyActionMode(ActionMode mode) {
-        }
-
-        public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
-            return false;
-        }
-    };
-
     public void onClick(View v) {
         Object tag = v.getTag();
         if (tag instanceof ShortcutInfo) {