Merge "Tweaking page indicators to support add page icon, remembering widget picker page (Bug 10787439)" into jb-ub-now-indigo-rose
diff --git a/res/drawable-hdpi/overscroll_glow_left.9.png b/res/drawable-hdpi/overscroll_glow_left.9.png
index a37592d..782ecf1 100644
--- a/res/drawable-hdpi/overscroll_glow_left.9.png
+++ b/res/drawable-hdpi/overscroll_glow_left.9.png
Binary files differ
diff --git a/res/drawable-hdpi/overscroll_glow_right.9.png b/res/drawable-hdpi/overscroll_glow_right.9.png
index f0f7084..d034864 100644
--- a/res/drawable-hdpi/overscroll_glow_right.9.png
+++ b/res/drawable-hdpi/overscroll_glow_right.9.png
Binary files differ
diff --git a/res/drawable-mdpi/overscroll_glow_left.9.png b/res/drawable-mdpi/overscroll_glow_left.9.png
index 897e63d..147e6a6 100644
--- a/res/drawable-mdpi/overscroll_glow_left.9.png
+++ b/res/drawable-mdpi/overscroll_glow_left.9.png
Binary files differ
diff --git a/res/drawable-mdpi/overscroll_glow_right.9.png b/res/drawable-mdpi/overscroll_glow_right.9.png
index dc6ecac..1321303 100644
--- a/res/drawable-mdpi/overscroll_glow_right.9.png
+++ b/res/drawable-mdpi/overscroll_glow_right.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/overscroll_glow_left.9.png b/res/drawable-xhdpi/overscroll_glow_left.9.png
index fbfa190..8ece7f2 100644
--- a/res/drawable-xhdpi/overscroll_glow_left.9.png
+++ b/res/drawable-xhdpi/overscroll_glow_left.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/overscroll_glow_right.9.png b/res/drawable-xhdpi/overscroll_glow_right.9.png
index 9c66c33..818a70d 100644
--- a/res/drawable-xhdpi/overscroll_glow_right.9.png
+++ b/res/drawable-xhdpi/overscroll_glow_right.9.png
Binary files differ
diff --git a/res/drawable-xxhdpi/overscroll_glow_left.9.png b/res/drawable-xxhdpi/overscroll_glow_left.9.png
index ae20624..e188ce8 100644
--- a/res/drawable-xxhdpi/overscroll_glow_left.9.png
+++ b/res/drawable-xxhdpi/overscroll_glow_left.9.png
Binary files differ
diff --git a/res/drawable-xxhdpi/overscroll_glow_right.9.png b/res/drawable-xxhdpi/overscroll_glow_right.9.png
index b083720..5766761 100644
--- a/res/drawable-xxhdpi/overscroll_glow_right.9.png
+++ b/res/drawable-xxhdpi/overscroll_glow_right.9.png
Binary files differ
diff --git a/res/layout-port/apps_customize_application.xml b/res/layout-port/apps_customize_application.xml
deleted file mode 100644
index 0b7bab6..0000000
--- a/res/layout-port/apps_customize_application.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<com.android.launcher3.PagedViewIcon
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
-
-    style="@style/WorkspaceIcon.Portrait.AppsCustomize"
-
-    android:id="@+id/application_icon"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:gravity="center_horizontal"
-
-    android:focusable="true"
-    android:background="@drawable/focusable_view_bg" />
diff --git a/res/layout-land/apps_customize_application.xml b/res/layout/apps_customize_application.xml
similarity index 91%
rename from res/layout-land/apps_customize_application.xml
rename to res/layout/apps_customize_application.xml
index bf0022d..3b0fa6f 100644
--- a/res/layout-land/apps_customize_application.xml
+++ b/res/layout/apps_customize_application.xml
@@ -18,12 +18,11 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
 
-    style="@style/WorkspaceIcon.Landscape.AppsCustomize"
+    style="@style/WorkspaceIcon.AppsCustomize"
 
     android:id="@+id/application_icon"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:gravity="center_horizontal"
-
+    
     android:focusable="true"
     android:background="@drawable/focusable_view_bg" />
diff --git a/res/layout/folder_icon.xml b/res/layout/folder_icon.xml
index 5a9a834..9c5c46b 100644
--- a/res/layout/folder_icon.xml
+++ b/res/layout/folder_icon.xml
@@ -28,6 +28,6 @@
         android:layout_height="wrap_content"
         android:src="@drawable/portal_ring_inner_holo"/>
     <com.android.launcher3.BubbleTextView
-        android:id="@+id/folder_icon_name"
-        style="@style/WorkspaceIcon"/>
+        style="@style/WorkspaceIcon"
+        android:id="@+id/folder_icon_name" />
 </com.android.launcher3.FolderIcon>
diff --git a/res/layout/live_wallpaper_picker_item.xml b/res/layout/live_wallpaper_picker_item.xml
new file mode 100644
index 0000000..29aa12c
--- /dev/null
+++ b/res/layout/live_wallpaper_picker_item.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<com.android.launcher3.CheckableFrameLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="@dimen/wallpaperThumbnailWidth"
+    android:layout_height="@dimen/wallpaperThumbnailHeight"
+    android:focusable="true"
+    android:clickable="true"
+    android:background="@drawable/wallpaper_tile_fg"
+    android:foreground="@drawable/wallpaper_tile_fg">
+    <ImageView
+        android:id="@+id/wallpaper_image"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_gravity="center"
+        android:background="@android:color/black"
+        android:scaleType="centerCrop" />
+    <ImageView
+        android:id="@+id/wallpaper_icon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:visibility="gone" />
+    <TextView
+        android:id="@+id/wallpaper_item_label"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center"
+        android:padding="4dp"
+        android:layout_gravity="bottom"
+        android:background="@color/wallpaper_picker_translucent_gray"
+        android:textColor="@android:color/white"/>
+</com.android.launcher3.CheckableFrameLayout>
diff --git a/res/layout/third_party_wallpaper_picker_item.xml b/res/layout/third_party_wallpaper_picker_item.xml
new file mode 100644
index 0000000..c2aeade
--- /dev/null
+++ b/res/layout/third_party_wallpaper_picker_item.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<com.android.launcher3.CheckableFrameLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="@dimen/wallpaperThumbnailWidth"
+    android:layout_height="@dimen/wallpaperThumbnailHeight"
+    android:focusable="true"
+    android:clickable="true"
+    android:background="@drawable/wallpaper_tile_fg"
+    android:foreground="@drawable/wallpaper_tile_fg">
+    <ImageView
+        android:id="@+id/wallpaper_image"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@color/wallpaper_picker_translucent_gray"
+        android:scaleType="centerCrop" />
+    <TextView
+        android:id="@+id/wallpaper_item_label"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:drawablePadding="4dp"
+        android:textColor="@android:color/white"/>
+</com.android.launcher3.CheckableFrameLayout>
diff --git a/res/layout/wallpaper_picker.xml b/res/layout/wallpaper_picker.xml
index a0672f6..53c529c 100644
--- a/res/layout/wallpaper_picker.xml
+++ b/res/layout/wallpaper_picker.xml
@@ -50,10 +50,23 @@
         <HorizontalScrollView
             android:layout_width="match_parent"
             android:layout_height="wrap_content" >
-            <LinearLayout android:id="@+id/wallpaper_list"
-                android:layout_width="match_parent"
+            <LinearLayout android:id="@+id/master_wallpaper_list"
+                android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:orientation="horizontal" />
+                android:orientation="horizontal" >
+                <LinearLayout android:id="@+id/third_party_wallpaper_list"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:orientation="horizontal" />
+                <LinearLayout android:id="@+id/wallpaper_list"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:orientation="horizontal" />
+                <LinearLayout android:id="@+id/live_wallpaper_list"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:orientation="horizontal" />
+            </LinearLayout>
         </HorizontalScrollView>
         <View
             android:layout_width="match_parent"
diff --git a/res/layout/wallpaper_picker_gallery_item.xml b/res/layout/wallpaper_picker_gallery_item.xml
index 976d3fa..d14ab3e 100644
--- a/res/layout/wallpaper_picker_gallery_item.xml
+++ b/res/layout/wallpaper_picker_gallery_item.xml
@@ -26,7 +26,7 @@
         android:id="@+id/wallpaper_image"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:background="#66000000"
+        android:background="@color/wallpaper_picker_translucent_gray"
         android:scaleType="centerCrop" />
     <TextView
         android:id="@+id/wallpaper_item_label"
@@ -36,5 +36,5 @@
         android:text="@string/pick_image"
         android:drawableTop="@drawable/ic_images"
         android:drawablePadding="4dp"
-        android:textColor="#FFFFFFFF"/>
+        android:textColor="@android:color/white"/>
 </com.android.launcher3.CheckableFrameLayout>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index bd561ed..01fd64c 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -32,4 +32,5 @@
     <color name="workspace_icon_text_color">#FFF</color>
 
     <color name="apps_customize_icon_text_color">#FFF</color>
+    <color name="wallpaper_picker_translucent_gray">#66000000</color>
 </resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index cf77b51..48b9dbc 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -82,15 +82,11 @@
     <style name="WorkspaceIcon.Landscape">
     </style>
 
-    <style name="WorkspaceIcon.Portrait.AppsCustomize">
+    <style name="WorkspaceIcon.AppsCustomize">
         <item name="android:shadowRadius">0.0</item> <!-- Don't use text shadow -->
         <item name="android:background">@null</item>
         <item name="android:textColor">@color/apps_customize_icon_text_color</item>
-    </style>
-    <style name="WorkspaceIcon.Landscape.AppsCustomize">
-        <item name="android:shadowRadius">0.0</item> <!-- Don't use text shadow -->
-        <item name="android:background">@null</item>
-        <item name="android:textColor">@color/apps_customize_icon_text_color</item>
+        <item name="android:drawablePadding">4dp</item>
     </style>
 
     <style name="QSBBar">
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index bb6903d..7a7a3b6 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -102,10 +102,13 @@
 
     public void applyFromShortcutInfo(ShortcutInfo info, IconCache iconCache) {
         Bitmap b = info.getIcon(iconCache);
+        LauncherAppState app = LauncherAppState.getInstance();
+        DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
 
         setCompoundDrawablesWithIntrinsicBounds(null,
                 new FastBitmapDrawable(b),
                 null, null);
+        setCompoundDrawablePadding((int) ((grid.folderIconSizePx - grid.iconSizePx) / 2f));
         setText(info.title);
         setTag(info);
     }
diff --git a/src/com/android/launcher3/CropView.java b/src/com/android/launcher3/CropView.java
index 32c590d..c4d1475 100644
--- a/src/com/android/launcher3/CropView.java
+++ b/src/com/android/launcher3/CropView.java
@@ -44,6 +44,7 @@
     public interface TouchCallback {
         void onTouchDown();
         void onTap();
+        void onTouchUp();
     }
 
     public CropView(Context context) {
@@ -202,6 +203,7 @@
                     now < mTouchDownTime + ViewConfiguration.getTapTimeout()) {
                 mTouchCallback.onTap();
             }
+            mTouchCallback.onTouchUp();
         }
 
         if (!mTouchEnabled) {
diff --git a/src/com/android/launcher3/DragController.java b/src/com/android/launcher3/DragController.java
index f51366f..4c4f399 100644
--- a/src/com/android/launcher3/DragController.java
+++ b/src/com/android/launcher3/DragController.java
@@ -687,10 +687,6 @@
             }
         }
         mDragObject.dragSource.onDropCompleted((View) dropTarget, mDragObject, false, accepted);
-
-        // Write all the logs to disk
-        Launcher.addDumpLog(TAG, "10249126 - DragController.drop() - dumping logs to disk", true);
-        mLauncher.dumpLogsToLocalData(false);
     }
 
     private DropTarget findDropTarget(int x, int y, int[] dropCoordinates) {
diff --git a/src/com/android/launcher3/DynamicGrid.java b/src/com/android/launcher3/DynamicGrid.java
index 70f0000..6e10175 100644
--- a/src/com/android/launcher3/DynamicGrid.java
+++ b/src/com/android/launcher3/DynamicGrid.java
@@ -207,7 +207,7 @@
 
         // Folder
         folderCellWidthPx = cellWidthPx + 3 * edgeMarginPx;
-        folderCellHeightPx = cellHeightPx + edgeMarginPx;
+        folderCellHeightPx = cellHeightPx + (int) ((3f/2f) * edgeMarginPx);
         folderBackgroundOffset = -edgeMarginPx;
         folderIconSizePx = iconSizePx + 2 * -folderBackgroundOffset;
     }
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index ad7d238..89d4cb3 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -130,6 +130,7 @@
     static final boolean DEBUG_WIDGETS = false;
     static final boolean DEBUG_STRICT_MODE = false;
     static final boolean DEBUG_RESUME_TIME = false;
+    static final boolean DEBUG_DUMP_LOG = false;
 
     private static final int REQUEST_CREATE_SHORTCUT = 1;
     private static final int REQUEST_CREATE_APPWIDGET = 5;
@@ -889,10 +890,6 @@
         if (DEBUG_RESUME_TIME) {
             Log.d(TAG, "Time spent in onResume: " + (System.currentTimeMillis() - startTime));
         }
-
-        // Write all the logs to disk
-        Launcher.addDumpLog(TAG, "10249126 - onResume() - dumping logs to disk", true);
-        dumpLogsToLocalData(false);
     }
 
     @Override
@@ -909,10 +906,6 @@
         mPaused = true;
         mDragController.cancelDrag();
         mDragController.resetLastGestureUpTime();
-
-        // Write all the logs to disk
-        Launcher.addDumpLog(TAG, "10249126 - onPause() - dumping logs to disk", true);
-        dumpLogsToLocalData(false);
     }
 
     protected void onFinishBindingItems() {
@@ -930,12 +923,14 @@
 
             if (mWorkspace.isOnOrMovingToCustomContent()) {
                 mSearchDropTargetBar.setTranslationY(- scrollY);
+                getQsbBar().setTranslationY(-scrollY);
             }
         }
     };
 
     public void resetQSBScroll() {
         mSearchDropTargetBar.animate().translationY(0).start();
+        getQsbBar().animate().translationY(0).start();
     }
 
     public interface CustomContentCallbacks {
@@ -3586,7 +3581,6 @@
     public void bindAddScreens(ArrayList<Long> orderedScreenIds) {
         int count = orderedScreenIds.size();
         for (int i = 0; i < count; i++) {
-            Launcher.addDumpLog(TAG, "10249126 - bindAddScreens(" + orderedScreenIds.get(i) + ")", true);
             mWorkspace.insertNewWorkspaceScreenBeforeEmptyScreen(orderedScreenIds.get(i));
         }
     }
@@ -3644,8 +3638,6 @@
             return;
         }
 
-        Launcher.addDumpLog(TAG, "10249126 - bindAppsAdded(" + newScreens.size() + ")", true);
-
         // Add the new screens
         bindAddScreens(newScreens);
 
@@ -3868,10 +3860,6 @@
                 onFinishBindingItems();
             }
         });
-
-        // Write all the logs to disk
-        Launcher.addDumpLog(TAG, "10249126 - finishBindingItems() - dumping logs to disk", true);
-        dumpLogsToLocalData(false);
     }
 
     private boolean canRunNewAppsAnimation() {
@@ -4272,15 +4260,17 @@
     }
 
     public static void dumpDebugLogsToConsole() {
-        synchronized (sDumpLogs) {
-            Log.d(TAG, "");
-            Log.d(TAG, "*********************");
-            Log.d(TAG, "Launcher debug logs: ");
-            for (int i = 0; i < sDumpLogs.size(); i++) {
-                Log.d(TAG, "  " + sDumpLogs.get(i));
+        if (DEBUG_DUMP_LOG) {
+            synchronized (sDumpLogs) {
+                Log.d(TAG, "");
+                Log.d(TAG, "*********************");
+                Log.d(TAG, "Launcher debug logs: ");
+                for (int i = 0; i < sDumpLogs.size(); i++) {
+                    Log.d(TAG, "  " + sDumpLogs.get(i));
+                }
+                Log.d(TAG, "*********************");
+                Log.d(TAG, "");
             }
-            Log.d(TAG, "*********************");
-            Log.d(TAG, "");
         }
     }
 
@@ -4288,105 +4278,59 @@
         if (debugLog) {
             Log.d(tag, log);
         }
-        sDateStamp.setTime(System.currentTimeMillis());
-        synchronized (sDumpLogs) {
-            sDumpLogs.add(sDateFormat.format(sDateStamp) + ": " + tag + ", " + log);
-        }
-    }
-
-    public void dumpLogsToLocalData(final boolean email) {
-        new Thread("DumpLogsToLocalData") {
-            @Override
-            public void run() {
-                boolean success = false;
-                sDateStamp.setTime(sRunStart);
-                String FILENAME = sDateStamp.getMonth() + "-"
-                        + sDateStamp.getDay() + "_"
-                        + sDateStamp.getHours() + "-"
-                        + sDateStamp.getMinutes() + "_"
-                        + sDateStamp.getSeconds() + ".txt";
-
-                FileOutputStream fos = null;
-                File outFile = null;
-                try {
-                    outFile = new File(getFilesDir(), FILENAME);
-                    outFile.createNewFile();
-                    fos = new FileOutputStream(outFile);
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-                if (fos != null) {
-                    PrintWriter writer = new PrintWriter(fos);
-
-                    writer.println(" ");
-                    writer.println("Debug logs: ");
-                    synchronized (sDumpLogs) {
-                        for (int i = 0; i < sDumpLogs.size(); i++) {
-                            writer.println("  " + sDumpLogs.get(i));
-                        }
-                    }
-                    writer.close();
-                }
-                try {
-                    if (fos != null) {
-                        fos.close();
-                        success = true;
-                    }
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-
-                if (success && email) {
-                    if (!emailSent()) {
-                        emailFile(outFile);
-                    }
-                }
+        if (DEBUG_DUMP_LOG) {
+            sDateStamp.setTime(System.currentTimeMillis());
+            synchronized (sDumpLogs) {
+                sDumpLogs.add(sDateFormat.format(sDateStamp) + ": " + tag + ", " + log);
             }
-        }.start();
+        }
     }
 
-    private void emailFile(File file) {
-        File publicCopy = new File(Environment.getExternalStorageDirectory(), file.getName());
-        try {
-            copyFile(file, publicCopy);
-        } catch (IOException e) {
-            e.printStackTrace();
-            return;
+    public void dumpLogsToLocalData() {
+        if (DEBUG_DUMP_LOG) {
+            new Thread("DumpLogsToLocalData") {
+                @Override
+                public void run() {
+                    boolean success = false;
+                    sDateStamp.setTime(sRunStart);
+                    String FILENAME = sDateStamp.getMonth() + "-"
+                            + sDateStamp.getDay() + "_"
+                            + sDateStamp.getHours() + "-"
+                            + sDateStamp.getMinutes() + "_"
+                            + sDateStamp.getSeconds() + ".txt";
+
+                    FileOutputStream fos = null;
+                    File outFile = null;
+                    try {
+                        outFile = new File(getFilesDir(), FILENAME);
+                        outFile.createNewFile();
+                        fos = new FileOutputStream(outFile);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    if (fos != null) {
+                        PrintWriter writer = new PrintWriter(fos);
+
+                        writer.println(" ");
+                        writer.println("Debug logs: ");
+                        synchronized (sDumpLogs) {
+                            for (int i = 0; i < sDumpLogs.size(); i++) {
+                                writer.println("  " + sDumpLogs.get(i));
+                            }
+                        }
+                        writer.close();
+                    }
+                    try {
+                        if (fos != null) {
+                            fos.close();
+                            success = true;
+                        }
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                }
+            }.start();
         }
-
-        Intent intent = new Intent(Intent.ACTION_SEND);
-        intent.setType("text/plain");
-        intent.putExtra(Intent.EXTRA_EMAIL, new String[] {"adamcohen@google.com, winsonc@google.com," +
-			"mikejurka@google"});
-        intent.putExtra(Intent.EXTRA_SUBJECT, "Data corruption " + file.getName());
-        intent.putExtra(Intent.EXTRA_TEXT, "Data corruption has occurred, logs attached");
-
-        if (!file.exists() || !file.canRead()) {
-            Toast.makeText(this, "Attachment Error", Toast.LENGTH_SHORT).show();
-            finish();
-            return;
-        }
-
-        Toast.makeText(this, "Data corruption has occurred, please send e-mail", Toast.LENGTH_LONG);
-        Uri uri = Uri.fromFile(publicCopy);
-        intent.putExtra(Intent.EXTRA_STREAM, uri);
-        startActivity(Intent.createChooser(intent, "Please send logs, consider clearing data"));
-
-        setEmailSent(true);
-    }
-
-    public void copyFile(File src, File dst) throws IOException {
-        InputStream in = new FileInputStream(src);
-        OutputStream out = new FileOutputStream(dst);
-
-        // Transfer bytes from in to out
-        byte[] buf = new byte[1024];
-        int len;
-        while ((len = in.read(buf)) > 0) {
-            out.write(buf, 0, len);
-        }
-        in.close();
-        out.close();
     }
 }
 
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index aaa901a..bc0d1bc 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -170,7 +170,7 @@
         public void bindPackagesUpdated(ArrayList<Object> widgetsAndShortcuts);
         public void bindSearchablesChanged();
         public void onPageBoundSynchronously(int page);
-        public void dumpLogsToLocalData(boolean email);
+        public void dumpLogsToLocalData();
     }
 
     public interface ItemInfoFilter {
@@ -286,7 +286,6 @@
     }
     public void addAndBindAddedApps(final Context context, final ArrayList<ItemInfo> added,
                                     final Callbacks callbacks, final ArrayList<AppInfo> addedApps) {
-        Launcher.addDumpLog(TAG, "10249126 - addAndBindAddedApps()", true);
         if (added.isEmpty()) {
             return;
         }
@@ -333,7 +332,6 @@
                                     workspaceScreens.size());
                             while (numPagesToAdd > 0) {
                                 long screenId = lp.generateNewScreenId();
-                                Launcher.addDumpLog(TAG, "10249126 - addAndBindAddedApps(" + screenId + ")", true);
                                 // Save the screen id for binding in the workspace
                                 workspaceScreens.add(screenId);
                                 addedWorkspaceScreensFinal.add(screenId);
@@ -365,8 +363,6 @@
                     }
                 }
 
-                Launcher.addDumpLog(TAG, "10249126 - addAndBindAddedApps - updateWorkspaceScreenOrder(" + workspaceScreens.size() + ")", true);
-
                 // Update the workspace screens
                 updateWorkspaceScreenOrder(context, workspaceScreens);
 
@@ -571,7 +567,6 @@
                     String msg = "item: " + item + " container being set to: " +
                             item.container + ", not in the list of folders";
                     Log.e(TAG, msg);
-                    Launcher.dumpDebugLogsToConsole();
                 }
             }
 
@@ -632,11 +627,6 @@
      */
     static void moveItemInDatabase(Context context, final ItemInfo item, final long container,
             final long screenId, final int cellX, final int cellY) {
-        String transaction = "DbDebug    Modify item (" + item.title + ") in db, id: " + item.id +
-                " (" + item.container + ", " + item.screenId + ", " + item.cellX + ", " + item.cellY +
-                ") --> " + "(" + container + ", " + screenId + ", " + cellX + ", " + cellY + ")";
-        Launcher.addDumpLog(TAG, transaction, true);
-
         item.container = container;
         item.cellX = cellX;
         item.cellY = cellY;
@@ -671,11 +661,6 @@
 
         for (int i = 0; i < count; i++) {
             ItemInfo item = items.get(i);
-            String transaction = "DbDebug    Modify item (" + item.title + ") in db, id: "
-                    + item.id + " (" + item.container + ", " + item.screenId + ", " + item.cellX
-                    + ", " + item.cellY + ") --> " + "(" + container + ", " + screen + ", "
-                    + item.cellX + ", " + item.cellY + ")";
-            Launcher.addDumpLog(TAG, transaction, true);
             item.container = container;
 
             // We store hotseat items in canonical form which is this orientation invariant position
@@ -704,11 +689,6 @@
      */
     static void modifyItemInDatabase(Context context, final ItemInfo item, final long container,
             final long screenId, final int cellX, final int cellY, final int spanX, final int spanY) {
-        String transaction = "DbDebug    Modify item (" + item.title + ") in db, id: " + item.id +
-                " (" + item.container + ", " + item.screenId + ", " + item.cellX + ", " + item.cellY +
-                ") --> " + "(" + container + ", " + screenId + ", " + cellX + ", " + cellY + ")";
-        Launcher.addDumpLog(TAG, transaction, true);
-
         item.cellX = cellX;
         item.cellY = cellY;
         item.spanX = spanX;
@@ -874,11 +854,6 @@
 
         Runnable r = new Runnable() {
             public void run() {
-                String transaction = "DbDebug    Add item (" + item.title + ") to db, id: "
-                        + item.id + " (" + container + ", " + screenId + ", " + cellX + ", "
-                        + cellY + ")";
-                Launcher.addDumpLog(TAG, transaction, true);
-
                 cr.insert(notify ? LauncherSettings.Favorites.CONTENT_URI :
                         LauncherSettings.Favorites.CONTENT_URI_NO_NOTIFICATION, values);
 
@@ -901,7 +876,6 @@
                                     String msg = "adding item: " + item + " to a folder that " +
                                             " doesn't exist";
                                     Log.e(TAG, msg);
-                                    Launcher.dumpDebugLogsToConsole();
                                 }
                             }
                             break;
@@ -935,11 +909,6 @@
 
         Runnable r = new Runnable() {
             public void run() {
-                String transaction = "DbDebug    Delete item (" + item.title + ") from db, id: "
-                        + item.id + " (" + item.container + ", " + item.screenId + ", " + item.cellX +
-                        ", " + item.cellY + ")";
-                Launcher.addDumpLog(TAG, transaction, true);
-
                 cr.delete(uriToDelete, null, null);
 
                 // Lock on mBgLock *after* the db operation
@@ -954,7 +923,6 @@
                                     String msg = "deleting a folder (" + item + ") which still " +
                                             "contains items (" + info + ")";
                                     Log.e(TAG, msg);
-                                    Launcher.dumpDebugLogsToConsole();
                                 }
                             }
                             sBgWorkspaceItems.remove(item);
@@ -980,7 +948,6 @@
      * a list of screen ids in the order that they should appear.
      */
     void updateWorkspaceScreenOrder(Context context, final ArrayList<Long> screens) {
-        Launcher.addDumpLog(TAG, "10249126 - updateWorkspaceScreenOrder()", true);
         final ArrayList<Long> screensCopy = new ArrayList<Long>(screens);
         final ContentResolver cr = context.getContentResolver();
         final Uri uri = LauncherSettings.WorkspaceScreens.CONTENT_URI;
@@ -990,17 +957,10 @@
         while (iter.hasNext()) {
             long id = iter.next();
             if (id < 0) {
-                Launcher.addDumpLog(TAG, "10249126 - updateWorkspaceScreenOrder - remove: " + id + ")", true);
                 iter.remove();
             }
         }
 
-        // Dump the screens copy
-        Launcher.addDumpLog(TAG, "10249126 - updateWorkspaceScreenOrder - screensCopy", true);
-        for (Long l : screensCopy) {
-            Launcher.addDumpLog(TAG, "10249126\t- " + l, true);
-        }
-
         Runnable r = new Runnable() {
             @Override
             public void run() {
@@ -1013,26 +973,13 @@
                     long screenId = screensCopy.get(i);
                     v.put(LauncherSettings.WorkspaceScreens._ID, screenId);
                     v.put(LauncherSettings.WorkspaceScreens.SCREEN_RANK, i);
-                    Launcher.addDumpLog(TAG, "10249126 - updateWorkspaceScreenOrder(" + screenId + ", " + i + ")", true);
                     values[i] = v;
                 }
                 cr.bulkInsert(uri, values);
 
                 synchronized (sBgLock) {
-                    // Dump the sBgWorkspaceScreens
-                    Launcher.addDumpLog(TAG, "10249126 - updateWorkspaceScreenOrder - sBgWorkspaceScreens - pre clear", true);
-                    for (Long l : sBgWorkspaceScreens) {
-                        Launcher.addDumpLog(TAG, "10249126\t- " + l, true);
-                    }
-
                     sBgWorkspaceScreens.clear();
                     sBgWorkspaceScreens.addAll(screensCopy);
-
-                    // Dump the sBgWorkspaceScreens
-                    Launcher.addDumpLog(TAG, "10249126 - updateWorkspaceScreenOrder - sBgWorkspaceScreens - post clear", true);
-                    for (Long l : sBgWorkspaceScreens) {
-                        Launcher.addDumpLog(TAG, "10249126\t- " + l, true);
-                    }
                 }
             }
         };
@@ -1273,9 +1220,6 @@
                 try {
                     long screenId = sc.getLong(idIndex);
                     int rank = sc.getInt(rankIndex);
-
-                    Launcher.addDumpLog(TAG, "10249126 - loadWorkspaceScreensDb(" + screenId + ", " + rank + ")", true);
-
                     orderedScreens.put(rank, screenId);
                 } catch (Exception e) {
                     Launcher.addDumpLog(TAG, "Desktop items loading interrupted - invalid screens: " + e, true);
@@ -1343,7 +1287,6 @@
                 isUpgradePath = loadWorkspace();
                 synchronized (LoaderTask.this) {
                     if (mStopped) {
-                        Launcher.addDumpLog(TAG, "10249126 - loadAndBindWorkspace() stopped", true);
                         return isUpgradePath;
                     }
                     mWorkspaceLoaded = true;
@@ -1484,10 +1427,7 @@
             if (AppsCustomizePagedView.DISABLE_ALL_APPS) {
                 // Ensure that all the applications that are in the system are
                 // represented on the home screen.
-                Launcher.addDumpLog(TAG, "10249126 - verifyApplications - useMoreApps="
-                        + UPGRADE_USE_MORE_APPS_FOLDER + " isUpgrade=" + isUpgrade, true);
                 if (!UPGRADE_USE_MORE_APPS_FOLDER || !isUpgrade) {
-                    Launcher.addDumpLog(TAG, "10249126 - verifyApplications(" + isUpgrade + ")", true);
                     verifyApplications();
                 }
             }
@@ -1507,7 +1447,6 @@
 
         public void stopLocked() {
             synchronized (LoaderTask.this) {
-                Launcher.addDumpLog(TAG, "10249126 - STOPPED", true);
                 mStopped = true;
                 this.notify();
             }
@@ -1552,7 +1491,6 @@
             synchronized (sBgLock) {
                 for (AppInfo app : mBgAllAppsList.data) {
                     tmpInfos = getItemInfoForComponentName(app.componentName);
-                    Launcher.addDumpLog(TAG, "10249126 - \t" + app.componentName.getPackageName() + ", " + tmpInfos.isEmpty(), true);
                     if (tmpInfos.isEmpty()) {
                         // We are missing an application icon, so add this to the workspace
                         added.add(app);
@@ -1667,7 +1605,6 @@
 
             synchronized (sBgLock) {
                 clearSBgDataStructures();
-                Launcher.addDumpLog(TAG, "10249126 - loadWorkspace()", true);
 
                 final ArrayList<Long> itemsToRemove = new ArrayList<Long>();
                 final Uri contentUri = LauncherSettings.Favorites.CONTENT_URI;
@@ -1720,7 +1657,6 @@
                     long id;
                     Intent intent;
 
-                    Launcher.addDumpLog(TAG, "10249126 - Num rows: " + c.getCount(), true);
                     while (!mStopped && c.moveToNext()) {
                         try {
                             int itemType = c.getInt(itemTypeIndex);
@@ -1739,7 +1675,6 @@
                                             Uri uri = LauncherSettings.Favorites.getContentUri(id,
                                                     false);
                                             contentResolver.delete(uri, null, null);
-                                            Launcher.addDumpLog(TAG, "Invalid package removed: " + cn, true);
                                         } else {
                                             // If apps can be on external storage, then we just
                                             // leave them for the user to remove (maybe add
@@ -1932,7 +1867,6 @@
 
                 // Break early if we've stopped loading
                 if (mStopped) {
-                    Launcher.addDumpLog(TAG, "10249126 - loadWorkspace() - Stopped", true);
                     clearSBgDataStructures();
                     return false;
                 }
@@ -1956,14 +1890,12 @@
                 }
 
                 if (loadedOldDb) {
-                    Launcher.addDumpLog(TAG, "10249126 - loadWorkspace - loadedOldDb", true);
                     long maxScreenId = 0;
                     // If we're importing we use the old screen order.
                     for (ItemInfo item: sBgItemsIdMap.values()) {
                         long screenId = item.screenId;
                         if (item.container == LauncherSettings.Favorites.CONTAINER_DESKTOP &&
                                 !sBgWorkspaceScreens.contains(screenId)) {
-                            Launcher.addDumpLog(TAG, "10249126 - loadWorkspace-loadedOldDb(" + screenId + ")", true);
                             sBgWorkspaceScreens.add(screenId);
                             if (screenId > maxScreenId) {
                                 maxScreenId = screenId;
@@ -1972,12 +1904,6 @@
                     }
                     Collections.sort(sBgWorkspaceScreens);
 
-                    // Dump the sBgWorkspaceScreens
-                    Launcher.addDumpLog(TAG, "10249126 - updateWorkspaceScreenOrder - sBgWorkspaceScreens", true);
-                    for (Long l : sBgWorkspaceScreens) {
-                        Launcher.addDumpLog(TAG, "10249126\t- " + l, true);
-                    }
-
                     LauncherAppState.getLauncherProvider().updateMaxScreenId(maxScreenId);
                     updateWorkspaceScreenOrder(context, sBgWorkspaceScreens);
 
@@ -1989,50 +1915,24 @@
                     }
                     LauncherAppState.getLauncherProvider().updateMaxItemId(maxItemId);
                 } else {
-                    Launcher.addDumpLog(TAG, "10249126 - loadWorkspace - !loadedOldDb [" + sWorkerThread.getThreadId() + ", " + Process.myTid() + "]", true);
                     TreeMap<Integer, Long> orderedScreens = loadWorkspaceScreensDb(mContext);
                     for (Integer i : orderedScreens.keySet()) {
-                        Launcher.addDumpLog(TAG, "10249126 - adding to sBgWorkspaceScreens: " + orderedScreens.get(i), true);
                         sBgWorkspaceScreens.add(orderedScreens.get(i));
                     }
 
                     // Remove any empty screens
                     ArrayList<Long> unusedScreens = new ArrayList<Long>(sBgWorkspaceScreens);
-                    for (Long l : unusedScreens) {
-                        Launcher.addDumpLog(TAG, "10249126 - unused screens: " + l, true);
-                    }
-
-                    Launcher.addDumpLog(TAG, "10249126 - sBgItemsIdMap [" + sWorkerThread.getThreadId() + ", " + Process.myTid() + "]", true);
                     for (ItemInfo item: sBgItemsIdMap.values()) {
                         long screenId = item.screenId;
-                        Launcher.addDumpLog(TAG, "10249126 - \t" + item.container + ", " + screenId + " - " + unusedScreens.contains(screenId) + " | " + item, true);
-
                         if (item.container == LauncherSettings.Favorites.CONTAINER_DESKTOP &&
                                 unusedScreens.contains(screenId)) {
                             unusedScreens.remove(screenId);
-                            Launcher.addDumpLog(TAG, "10249126 - \t\tRemoving " + screenId, true);
-                            for (Long l : unusedScreens) {
-                                Launcher.addDumpLog(TAG, "10249126 - \t\t\t unused screens: " + l, true);
-                            }
                         }
                     }
 
                     // If there are any empty screens remove them, and update.
                     if (unusedScreens.size() != 0) {
-                        // Dump the sBgWorkspaceScreens
-                        Launcher.addDumpLog(TAG, "10249126 - updateWorkspaceScreenOrder - sBgWorkspaceScreens - pre removeAll", true);
-                        for (Long l : sBgWorkspaceScreens) {
-                            Launcher.addDumpLog(TAG, "10249126\t- " + l, true);
-                        }
-
                         sBgWorkspaceScreens.removeAll(unusedScreens);
-
-                        // Dump the sBgWorkspaceScreens
-                        Launcher.addDumpLog(TAG, "10249126 - updateWorkspaceScreenOrder - sBgWorkspaceScreens - post removeAll", true);
-                        for (Long l : sBgWorkspaceScreens) {
-                            Launcher.addDumpLog(TAG, "10249126\t- " + l, true);
-                        }
-
                         updateWorkspaceScreenOrder(context, sBgWorkspaceScreens);
                     }
                 }
@@ -2185,16 +2085,6 @@
 
         private void bindWorkspaceScreens(final Callbacks oldCallbacks,
                 final ArrayList<Long> orderedScreens) {
-            Launcher.addDumpLog(TAG, "10249126 - bindWorkspaceScreens()", true);
-
-            // Dump the orderedScreens
-            synchronized (sBgLock) {
-                Launcher.addDumpLog(TAG, "10249126 - orderedScreens", true);
-                for (Long l : sBgWorkspaceScreens) {
-                    Launcher.addDumpLog(TAG, "10249126\t- " + l, true);
-                }
-            }
-
             final Runnable r = new Runnable() {
                 @Override
                 public void run() {
@@ -2278,7 +2168,6 @@
          * Binds all loaded data to actual views on the main thread.
          */
         private void bindWorkspace(int synchronizeBindPage, final boolean isUpgradePath) {
-            Launcher.addDumpLog(TAG, "10249126 - bindWorkspace(" + synchronizeBindPage + ", " + isUpgradePath + ")", true);
             final long t = SystemClock.uptimeMillis();
             Runnable r;
 
@@ -2679,12 +2568,11 @@
             });
 
             // Write all the logs to disk
-            Launcher.addDumpLog(TAG, "10249126 - PackageUpdatedTask - dumping logs to disk", true);
             mHandler.post(new Runnable() {
                 public void run() {
                     Callbacks cb = mCallbacks != null ? mCallbacks.get() : null;
                     if (callbacks == cb && cb != null) {
-                        callbacks.dumpLogsToLocalData(false);
+                        callbacks.dumpLogsToLocalData();
                     }
                 }
             });
diff --git a/src/com/android/launcher3/LiveWallpaperListAdapter.java b/src/com/android/launcher3/LiveWallpaperListAdapter.java
new file mode 100644
index 0000000..a6facaa
--- /dev/null
+++ b/src/com/android/launcher3/LiveWallpaperListAdapter.java
@@ -0,0 +1,237 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.launcher3;
+
+import android.app.WallpaperInfo;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.pm.ResolveInfo;
+import android.graphics.drawable.Drawable;
+import android.os.AsyncTask;
+import android.service.wallpaper.WallpaperService;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
+import android.widget.ListAdapter;
+import android.widget.TextView;
+
+import org.xmlpull.v1.XmlPullParserException;
+
+import java.io.IOException;
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+public class LiveWallpaperListAdapter extends BaseAdapter implements ListAdapter {
+    private static final String LOG_TAG = "LiveWallpaperListAdapter";
+
+    private final LayoutInflater mInflater;
+    private final PackageManager mPackageManager;
+
+    private List<LiveWallpaperInfo> mWallpapers;
+
+    @SuppressWarnings("unchecked")
+    public LiveWallpaperListAdapter(Context context) {
+        mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+        mPackageManager = context.getPackageManager();
+
+        List<ResolveInfo> list = mPackageManager.queryIntentServices(
+                new Intent(WallpaperService.SERVICE_INTERFACE),
+                PackageManager.GET_META_DATA);
+
+        mWallpapers = generatePlaceholderViews(list.size());
+
+        new LiveWallpaperEnumerator(context).execute(list);
+    }
+
+    private List<LiveWallpaperInfo> generatePlaceholderViews(int amount) {
+        ArrayList<LiveWallpaperInfo> list = new ArrayList<LiveWallpaperInfo>(amount);
+        for (int i = 0; i < amount; i++) {
+            LiveWallpaperInfo info = new LiveWallpaperInfo();
+            list.add(info);
+        }
+        return list;
+    }
+
+    public int getCount() {
+        if (mWallpapers == null) {
+            return 0;
+        }
+        return mWallpapers.size();
+    }
+
+    public Object getItem(int position) {
+        return mWallpapers.get(position);
+    }
+
+    public long getItemId(int position) {
+        return position;
+    }
+
+    public View getView(int position, View convertView, ViewGroup parent) {
+        View view;
+
+        if (convertView == null) {
+            view = mInflater.inflate(R.layout.live_wallpaper_picker_item, parent, false);
+        } else {
+            view = convertView;
+        }
+
+        WallpaperPickerActivity.setWallpaperItemPaddingToZero((FrameLayout) view);
+
+        LiveWallpaperInfo wallpaperInfo = mWallpapers.get(position);
+        ImageView image = (ImageView) view.findViewById(R.id.wallpaper_image);
+        ImageView icon = (ImageView) view.findViewById(R.id.wallpaper_icon);
+        if (wallpaperInfo.thumbnail != null) {
+            image.setImageDrawable(wallpaperInfo.thumbnail);
+            icon.setVisibility(View.GONE);
+        } else {
+            icon.setImageDrawable(wallpaperInfo.info.loadIcon(mPackageManager));
+            icon.setVisibility(View.VISIBLE);
+        }
+
+        TextView label = (TextView) view.findViewById(R.id.wallpaper_item_label);
+        label.setText(wallpaperInfo.info.loadLabel(mPackageManager));
+
+        return view;
+    }
+
+    public class LiveWallpaperInfo {
+        public Drawable thumbnail;
+        public WallpaperInfo info;
+        public Intent intent;
+    }
+
+    private class LiveWallpaperEnumerator extends
+            AsyncTask<List<ResolveInfo>, LiveWallpaperInfo, Void> {
+        private Context mContext;
+        private int mWallpaperPosition;
+
+        public LiveWallpaperEnumerator(Context context) {
+            super();
+            mContext = context;
+            mWallpaperPosition = 0;
+        }
+
+        @Override
+        protected Void doInBackground(List<ResolveInfo>... params) {
+            final PackageManager packageManager = mContext.getPackageManager();
+
+            List<ResolveInfo> list = params[0];
+
+            Collections.sort(list, new Comparator<ResolveInfo>() {
+                final Collator mCollator;
+
+                {
+                    mCollator = Collator.getInstance();
+                }
+
+                public int compare(ResolveInfo info1, ResolveInfo info2) {
+                    return mCollator.compare(info1.loadLabel(packageManager),
+                            info2.loadLabel(packageManager));
+                }
+            });
+
+            for (ResolveInfo resolveInfo : list) {
+                WallpaperInfo info = null;
+                try {
+                    info = new WallpaperInfo(mContext, resolveInfo);
+                } catch (XmlPullParserException e) {
+                    Log.w(LOG_TAG, "Skipping wallpaper " + resolveInfo.serviceInfo, e);
+                    continue;
+                } catch (IOException e) {
+                    Log.w(LOG_TAG, "Skipping wallpaper " + resolveInfo.serviceInfo, e);
+                    continue;
+                }
+
+                LiveWallpaperInfo wallpaper = new LiveWallpaperInfo();
+                wallpaper.intent = new Intent(WallpaperService.SERVICE_INTERFACE);
+                wallpaper.intent.setClassName(info.getPackageName(), info.getServiceName());
+                wallpaper.info = info;
+
+                Drawable thumb = info.loadThumbnail(packageManager);
+                // TODO: generate a default thumb
+                /*
+                final Resources res = mContext.getResources();
+                Canvas canvas = new Canvas();
+                Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
+                paint.setTextAlign(Paint.Align.CENTER);
+                BitmapDrawable galleryIcon = (BitmapDrawable) res.getDrawable(
+                        R.drawable.livewallpaper_placeholder);
+                if (thumb == null) {
+                    int thumbWidth = res.getDimensionPixelSize(
+                            R.dimen.live_wallpaper_thumbnail_width);
+                    int thumbHeight = res.getDimensionPixelSize(
+                            R.dimen.live_wallpaper_thumbnail_height);
+
+                    Bitmap thumbnail = Bitmap.createBitmap(thumbWidth, thumbHeight,
+                            Bitmap.Config.ARGB_8888);
+
+                    paint.setColor(res.getColor(R.color.live_wallpaper_thumbnail_background));
+                    canvas.setBitmap(thumbnail);
+                    canvas.drawPaint(paint);
+
+                    galleryIcon.setBounds(0, 0, thumbWidth, thumbHeight);
+                    galleryIcon.setGravity(Gravity.CENTER);
+                    galleryIcon.draw(canvas);
+
+                    String title = info.loadLabel(packageManager).toString();
+
+                    paint.setColor(res.getColor(R.color.live_wallpaper_thumbnail_text_color));
+                    paint.setTextSize(
+                            res.getDimensionPixelSize(R.dimen.live_wallpaper_thumbnail_text_size));
+
+                    canvas.drawText(title, (int) (thumbWidth * 0.5),
+                            thumbHeight - res.getDimensionPixelSize(
+                                    R.dimen.live_wallpaper_thumbnail_text_offset), paint);
+
+                    thumb = new BitmapDrawable(res, thumbnail);
+                }*/
+                wallpaper.thumbnail = thumb;
+                publishProgress(wallpaper);
+            }
+
+            return null;
+        }
+
+        @Override
+        protected void onProgressUpdate(LiveWallpaperInfo...infos) {
+            for (LiveWallpaperInfo info : infos) {
+                info.thumbnail.setDither(true);
+                if (mWallpaperPosition < mWallpapers.size()) {
+                    mWallpapers.set(mWallpaperPosition, info);
+                } else {
+                    mWallpapers.add(info);
+                }
+                mWallpaperPosition++;
+                if (mWallpaperPosition == getCount()) {
+                    LiveWallpaperListAdapter.this.notifyDataSetChanged();
+                }
+            }
+        }
+    }
+}
diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
index 5ce5571..b951100 100644
--- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java
+++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
@@ -137,7 +137,8 @@
                 // Otherwise, center the icon
                 int cHeight = mIsHotseatLayout ? grid.hotseatCellHeightPx : Math.min(getMeasuredHeight(), grid.cellHeightPx);
                 int cellPaddingY = (int) Math.max(0, ((lp.height - cHeight) / 2f));
-                child.setPadding(0, cellPaddingY, 0, 0);
+                int cellPaddingX = (int) (grid.edgeMarginPx / 2f);
+                child.setPadding(cellPaddingX, cellPaddingY, cellPaddingX, 0);
             }
         } else {
             lp.x = 0;
diff --git a/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java b/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java
new file mode 100644
index 0000000..9fd0d0a
--- /dev/null
+++ b/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.launcher3;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.FrameLayout;
+import android.widget.ListAdapter;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements ListAdapter {
+    private static final String LOG_TAG = "LiveWallpaperListAdapter";
+
+    private final LayoutInflater mInflater;
+    private final PackageManager mPackageManager;
+
+    private List<ResolveInfo> mThirdPartyWallpaperPickers = new ArrayList<ResolveInfo>();
+
+    public ThirdPartyWallpaperPickerListAdapter(Context context) {
+        mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+        mPackageManager = context.getPackageManager();
+        final PackageManager pm = mPackageManager;
+
+        final Intent pickWallpaperIntent = new Intent(Intent.ACTION_SET_WALLPAPER);
+        final List<ResolveInfo> apps =
+                pm.queryIntentActivities(pickWallpaperIntent, 0);
+
+        // Get list of image picker intents
+        Intent pickImageIntent = new Intent(Intent.ACTION_GET_CONTENT);
+        pickImageIntent.setType("image/*");
+        final List<ResolveInfo> imagePickerActivities =
+                pm.queryIntentActivities(pickImageIntent, 0);
+        final ComponentName[] imageActivities = new ComponentName[imagePickerActivities.size()];
+        for (int i = 0; i < imagePickerActivities.size(); i++) {
+            ActivityInfo activityInfo = imagePickerActivities.get(i).activityInfo;
+            imageActivities[i] = new ComponentName(activityInfo.packageName, activityInfo.name);
+        }
+
+        outerLoop:
+        for (ResolveInfo info : apps) {
+            final ComponentName itemComponentName =
+                    new ComponentName(info.activityInfo.packageName, info.activityInfo.name);
+            final String itemPackageName = itemComponentName.getPackageName();
+            // Exclude anything from our own package, and the old Launcher,
+            // and live wallpaper picker
+            if (itemPackageName.equals(context.getPackageName()) ||
+                    itemPackageName.equals("com.android.launcher") ||
+                    itemPackageName.equals("com.android.wallpaper.livepicker")) {
+                continue;
+            }
+            // Exclude any package that already responds to the image picker intent
+            for (ResolveInfo imagePickerActivityInfo : imagePickerActivities) {
+                if (itemPackageName.equals(
+                        imagePickerActivityInfo.activityInfo.packageName)) {
+                    continue outerLoop;
+                }
+            }
+            mThirdPartyWallpaperPickers.add(info);
+        }
+    }
+
+    public int getCount() {
+        return mThirdPartyWallpaperPickers.size();
+    }
+
+    public Object getItem(int position) {
+        return mThirdPartyWallpaperPickers.get(position);
+    }
+
+    public long getItemId(int position) {
+        return position;
+    }
+
+    public View getView(int position, View convertView, ViewGroup parent) {
+        View view;
+
+        if (convertView == null) {
+            view = mInflater.inflate(R.layout.third_party_wallpaper_picker_item, parent, false);
+        } else {
+            view = convertView;
+        }
+
+        WallpaperPickerActivity.setWallpaperItemPaddingToZero((FrameLayout) view);
+
+        ResolveInfo info = mThirdPartyWallpaperPickers.get(position);
+        TextView label = (TextView) view.findViewById(R.id.wallpaper_item_label);
+        label.setText(info.loadLabel(mPackageManager));
+        label.setCompoundDrawablesWithIntrinsicBounds(
+                null, info.loadIcon(mPackageManager), null, null);
+        return view;
+    }
+}
diff --git a/src/com/android/launcher3/WallpaperCropActivity.java b/src/com/android/launcher3/WallpaperCropActivity.java
index f5a6b80..f359480 100644
--- a/src/com/android/launcher3/WallpaperCropActivity.java
+++ b/src/com/android/launcher3/WallpaperCropActivity.java
@@ -138,12 +138,13 @@
         windowManager.getDefaultDisplay().getCurrentSizeRange(minDims, maxDims);
 
         int maxDim = Math.max(maxDims.x, maxDims.y);
-        final int minDim = Math.min(minDims.x, minDims.y);
+        int minDim = Math.max(minDims.x, minDims.y);
 
         if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
             Point realSize = new Point();
             windowManager.getDefaultDisplay().getRealSize(realSize);
             maxDim = Math.max(realSize.x, realSize.y);
+            minDim = Math.min(realSize.x, realSize.y);
         }
 
         // We need to ensure that there is enough extra space in the wallpaper
diff --git a/src/com/android/launcher3/WallpaperPickerActivity.java b/src/com/android/launcher3/WallpaperPickerActivity.java
index 824dea6..868b1df 100644
--- a/src/com/android/launcher3/WallpaperPickerActivity.java
+++ b/src/com/android/launcher3/WallpaperPickerActivity.java
@@ -19,6 +19,8 @@
 import android.animation.LayoutTransition;
 import android.app.ActionBar;
 import android.app.Activity;
+import android.app.WallpaperInfo;
+import android.app.WallpaperManager;
 import android.content.ComponentName;
 import android.content.Intent;
 import android.content.pm.ActivityInfo;
@@ -27,8 +29,10 @@
 import android.content.pm.ResolveInfo;
 import android.content.res.Resources;
 import android.database.Cursor;
+import android.database.DataSetObserver;
 import android.graphics.Bitmap;
 import android.graphics.Point;
+import android.graphics.PorterDuff;
 import android.graphics.Rect;
 import android.graphics.RectF;
 import android.graphics.drawable.Drawable;
@@ -66,6 +70,7 @@
 
     private static final int IMAGE_PICK = 5;
     private static final int PICK_WALLPAPER_THIRD_PARTY_ACTIVITY = 6;
+    private static final int PICK_LIVE_WALLPAPER = 7;
     private static final String TEMP_WALLPAPER_TILES = "TEMP_WALLPAPER_TILES";
 
     private ArrayList<Drawable> mBundledWallpaperThumbs;
@@ -85,12 +90,15 @@
 
     ArrayList<Uri> mTempWallpaperTiles = new ArrayList<Uri>();
     private SavedWallpaperImages mSavedImages;
+    private WallpaperInfo mLiveWallpaperInfoOnPickerLaunch;
 
     private static class ThumbnailMetaData {
-        public boolean mLaunchesGallery;
+        public TileType mTileType;
         public Uri mWallpaperUri;
         public int mSavedWallpaperDbId;
         public int mWallpaperResId;
+        public LiveWallpaperListAdapter.LiveWallpaperInfo mLiveWallpaperInfo;
+        public ResolveInfo mThirdPartyWallpaperPickerInfo;
     }
 
     // called by onCreate; this is subclassed to overwrite WallpaperCropActivity
@@ -101,6 +109,7 @@
         final View wallpaperStrip = findViewById(R.id.wallpaper_strip);
         mCropView.setTouchCallback(new CropView.TouchCallback() {
             LauncherViewPropertyAnimator mAnim;
+            @Override
             public void onTouchDown() {
                 if (mAnim != null) {
                     mAnim.cancel();
@@ -113,6 +122,11 @@
                         .setInterpolator(new DecelerateInterpolator(0.75f));
                 mAnim.start();
             }
+            @Override
+            public void onTouchUp() {
+                mIgnoreNextTap = false;
+            }
+            @Override
             public void onTap() {
                 boolean ignoreTap = mIgnoreNextTap;
                 mIgnoreNextTap = false;
@@ -142,29 +156,38 @@
                 }
 
                 ThumbnailMetaData meta = (ThumbnailMetaData) v.getTag();
-
-                if (!meta.mLaunchesGallery) {
+                if (meta.mTileType == TileType.WALLPAPER_RESOURCE ||
+                        meta.mTileType == TileType.SAVED_WALLPAPER ||
+                        meta.mTileType == TileType.WALLPAPER_URI) {
                     mSelectedThumb = v;
                     v.setSelected(true);
                 }
-
-                if (meta.mLaunchesGallery) {
+                if (meta.mTileType == TileType.PICK_IMAGE) {
                     Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
                     intent.setType("image/*");
                     Utilities.startActivityForResultSafely(
                             WallpaperPickerActivity.this, intent, IMAGE_PICK);
-                } else if (meta.mWallpaperUri != null) {
+                } else if (meta.mTileType == TileType.WALLPAPER_URI) {
                     mCropView.setTileSource(new BitmapRegionTileSource(WallpaperPickerActivity.this,
                             meta.mWallpaperUri, 1024, 0), null);
                     mCropView.setTouchEnabled(true);
-                } else if (meta.mSavedWallpaperDbId != 0) {
+                } else if (meta.mTileType == TileType.SAVED_WALLPAPER) {
                     String imageFilename = mSavedImages.getImageFilename(meta.mSavedWallpaperDbId);
                     File file = new File(getFilesDir(), imageFilename);
                     mCropView.setTileSource(new BitmapRegionTileSource(WallpaperPickerActivity.this,
                             file.getAbsolutePath(), 1024, 0), null);
                     mCropView.moveToLeft();
                     mCropView.setTouchEnabled(false);
-                } else if (meta.mWallpaperResId != 0) {
+                } else if (meta.mTileType == TileType.LIVE_WALLPAPER) {
+                    Intent preview = new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
+                    preview.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
+                            meta.mLiveWallpaperInfo.info.getComponent());
+                    WallpaperManager wm =
+                            WallpaperManager.getInstance(WallpaperPickerActivity.this);
+                    mLiveWallpaperInfoOnPickerLaunch = wm.getWallpaperInfo();
+                    Utilities.startActivityForResultSafely(WallpaperPickerActivity.this,
+                            preview, PICK_LIVE_WALLPAPER);
+                } else if (meta.mTileType == TileType.WALLPAPER_RESOURCE) {
                     BitmapRegionTileSource source = new BitmapRegionTileSource(mWallpaperResources,
                             WallpaperPickerActivity.this, meta.mWallpaperResId, 1024, 0);
                     mCropView.setTileSource(source, null);
@@ -175,6 +198,15 @@
                             wallpaperSize.x, wallpaperSize.y, false);
                     mCropView.setScale(wallpaperSize.x / crop.width());
                     mCropView.setTouchEnabled(false);
+                } else if (meta.mTileType == TileType.THIRD_PARTY_WALLPAPER_PICKER) {
+                    ResolveInfo info = meta.mThirdPartyWallpaperPickerInfo;
+
+                    final ComponentName itemComponentName = new ComponentName(
+                            info.activityInfo.packageName, info.activityInfo.name);
+                    Intent launchIntent = new Intent(Intent.ACTION_SET_WALLPAPER);
+                    launchIntent.setComponent(itemComponentName);
+                    Utilities.startActivityForResultSafely(WallpaperPickerActivity.this,
+                            launchIntent, PICK_WALLPAPER_THIRD_PARTY_ACTIVITY);
                 }
             }
         };
@@ -202,7 +234,8 @@
         findBundledWallpapers();
         mWallpapersView = (LinearLayout) findViewById(R.id.wallpaper_list);
         ImageAdapter ia = new ImageAdapter(this, mBundledWallpaperThumbs);
-        populateWallpapersFromAdapter(mWallpapersView, ia, mBundledWallpaperResIds, true, false);
+        populateWallpapersFromAdapter(
+                mWallpapersView, ia, mBundledWallpaperResIds, TileType.WALLPAPER_RESOURCE, false, true);
 
         // Populate the saved wallpapers
         mSavedImages = new SavedWallpaperImages(this);
@@ -210,13 +243,34 @@
         ArrayList<Drawable> savedWallpaperThumbs = mSavedImages.getThumbnails();
         ArrayList<Integer > savedWallpaperIds = mSavedImages.getImageIds();
         ia = new ImageAdapter(this, savedWallpaperThumbs);
-        populateWallpapersFromAdapter(mWallpapersView, ia, savedWallpaperIds, false, true);
+        populateWallpapersFromAdapter(
+                mWallpapersView, ia, savedWallpaperIds, TileType.SAVED_WALLPAPER, true, true);
+
+        // Populate the live wallpapers
+        final LinearLayout liveWallpapersView = (LinearLayout) findViewById(R.id.live_wallpaper_list);
+        final LiveWallpaperListAdapter a = new LiveWallpaperListAdapter(this);
+        a.registerDataSetObserver(new DataSetObserver() {
+            public void onChanged() {
+                liveWallpapersView.removeAllViews();
+                populateWallpapersFromAdapter(
+                        liveWallpapersView, a, null, TileType.LIVE_WALLPAPER, false, false);
+            }
+        });
+
+        // Populate the third-party wallpaper pickers
+        final LinearLayout thirdPartyWallpapersView =
+                (LinearLayout) findViewById(R.id.third_party_wallpaper_list);
+        final ThirdPartyWallpaperPickerListAdapter ta =
+                new ThirdPartyWallpaperPickerListAdapter(this);
+        populateWallpapersFromAdapter(thirdPartyWallpapersView, ta, null,
+                TileType.THIRD_PARTY_WALLPAPER_PICKER, false, false);
 
         // Add a tile for the Gallery
+        LinearLayout masterWallpaperList = (LinearLayout) findViewById(R.id.master_wallpaper_list);
         FrameLayout galleryThumbnail = (FrameLayout) getLayoutInflater().
-                inflate(R.layout.wallpaper_picker_gallery_item, mWallpapersView, false);
+                inflate(R.layout.wallpaper_picker_gallery_item, masterWallpaperList, false);
         setWallpaperItemPaddingToZero(galleryThumbnail);
-        mWallpapersView.addView(galleryThumbnail, 0);
+        masterWallpaperList.addView(galleryThumbnail, 0);
 
         // Make its background the last photo taken on external storage
         Bitmap lastPhoto = getThumbnailOfLastPhoto();
@@ -224,10 +278,12 @@
             ImageView galleryThumbnailBg =
                     (ImageView) galleryThumbnail.findViewById(R.id.wallpaper_image);
             galleryThumbnailBg.setImageBitmap(getThumbnailOfLastPhoto());
+            int colorOverlay = getResources().getColor(R.color.wallpaper_picker_translucent_gray);
+            galleryThumbnailBg.setColorFilter(colorOverlay, PorterDuff.Mode.SRC_ATOP);
         }
 
         ThumbnailMetaData meta = new ThumbnailMetaData();
-        meta.mLaunchesGallery = true;
+        meta.mTileType = TileType.PICK_IMAGE;
         galleryThumbnail.setTag(meta);
         galleryThumbnail.setOnClickListener(mThumbnailOnClickListener);
 
@@ -247,7 +303,7 @@
                     @Override
                     public void onClick(View v) {
                         ThumbnailMetaData meta = (ThumbnailMetaData) mSelectedThumb.getTag();
-                        if (meta.mLaunchesGallery) {
+                        if (meta.mTileType == TileType.PICK_IMAGE) {
                             // shouldn't be selected, but do nothing
                         } else if (meta.mWallpaperUri != null) {
                             boolean finishActivityWhenDone = true;
@@ -385,24 +441,39 @@
         }
     }
 
-    private void populateWallpapersFromAdapter(ViewGroup parent, ImageAdapter ia,
-            ArrayList<Integer> imageIds, boolean imagesAreResources, boolean addLongPressHandler) {
-        for (int i = 0; i < ia.getCount(); i++) {
-            FrameLayout thumbnail = (FrameLayout) ia.getView(i, null, parent);
+    private enum TileType {
+        PICK_IMAGE,
+        WALLPAPER_RESOURCE,
+        WALLPAPER_URI,
+        SAVED_WALLPAPER,
+        LIVE_WALLPAPER,
+        THIRD_PARTY_WALLPAPER_PICKER
+        };
+
+    private void populateWallpapersFromAdapter(ViewGroup parent, BaseAdapter adapter,
+            ArrayList<Integer> imageIds, TileType tileType, boolean addLongPressHandler, boolean selectFirstTile) {
+        for (int i = 0; i < adapter.getCount(); i++) {
+            FrameLayout thumbnail = (FrameLayout) adapter.getView(i, null, parent);
             parent.addView(thumbnail, i);
 
             ThumbnailMetaData meta = new ThumbnailMetaData();
-            if (imagesAreResources) {
+            meta.mTileType = tileType;
+            if (tileType == TileType.WALLPAPER_RESOURCE) {
                 meta.mWallpaperResId = imageIds.get(i);
-            } else {
+            } else if (tileType == TileType.SAVED_WALLPAPER) {
                 meta.mSavedWallpaperDbId = imageIds.get(i);
+            } else if (tileType == TileType.LIVE_WALLPAPER) {
+                meta.mLiveWallpaperInfo =
+                        (LiveWallpaperListAdapter.LiveWallpaperInfo) adapter.getItem(i);
+            } else if (tileType == TileType.THIRD_PARTY_WALLPAPER_PICKER) {
+                meta.mThirdPartyWallpaperPickerInfo = (ResolveInfo) adapter.getItem(i);
             }
             thumbnail.setTag(meta);
             if (addLongPressHandler) {
                 addLongPressHandler(thumbnail);
             }
             thumbnail.setOnClickListener(mThumbnailOnClickListener);
-            if (i == 0) {
+            if (i == 0 && selectFirstTile) {
                 mThumbnailOnClickListener.onClick(thumbnail);
             }
         }
@@ -452,9 +523,10 @@
         } else {
             Log.e(TAG, "Error loading thumbnail for uri=" + uri);
         }
-        mWallpapersView.addView(pickedImageThumbnail, 1);
+        mWallpapersView.addView(pickedImageThumbnail, 0);
 
         ThumbnailMetaData meta = new ThumbnailMetaData();
+        meta.mTileType = TileType.WALLPAPER_URI;
         meta.mWallpaperUri = uri;
         pickedImageThumbnail.setTag(meta);
         pickedImageThumbnail.setOnClickListener(mThumbnailOnClickListener);
@@ -466,13 +538,24 @@
             Uri uri = data.getData();
             addTemporaryWallpaperTile(uri);
         } else if (requestCode == PICK_WALLPAPER_THIRD_PARTY_ACTIVITY) {
-            // No result code is returned; just return
             setResult(RESULT_OK);
             finish();
+        } else if (requestCode == PICK_LIVE_WALLPAPER) {
+            WallpaperManager wm = WallpaperManager.getInstance(this);
+            final WallpaperInfo oldLiveWallpaper = mLiveWallpaperInfoOnPickerLaunch;
+            WallpaperInfo newLiveWallpaper = wm.getWallpaperInfo();
+            // Try to figure out if a live wallpaper was set;
+            if (newLiveWallpaper != null &&
+                    (oldLiveWallpaper == null ||
+                    !oldLiveWallpaper.getComponent().equals(newLiveWallpaper.getComponent()))) {
+                // Return if a live wallpaper was set
+                setResult(RESULT_OK);
+                finish();
+            }
         }
     }
 
-    private static void setWallpaperItemPaddingToZero(FrameLayout frameLayout) {
+    static void setWallpaperItemPaddingToZero(FrameLayout frameLayout) {
         frameLayout.setPadding(0, 0, 0, 0);
         frameLayout.setForeground(new ZeroPaddingDrawable(frameLayout.getForeground()));
     }
@@ -481,68 +564,6 @@
         v.setOnLongClickListener(mLongClickListener);
     }
 
-
-    public boolean onMenuItemSelected(int featureId, MenuItem item) {
-        if (item.getIntent() == null) {
-            return super.onMenuItemSelected(featureId, item);
-        } else {
-            Utilities.startActivityForResultSafely(
-                    this, item.getIntent(), PICK_WALLPAPER_THIRD_PARTY_ACTIVITY);
-            return true;
-        }
-    }
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        final Intent pickWallpaperIntent = new Intent(Intent.ACTION_SET_WALLPAPER);
-        final PackageManager pm = getPackageManager();
-        final List<ResolveInfo> apps =
-                pm.queryIntentActivities(pickWallpaperIntent, 0);
-
-        SubMenu sub = menu.addSubMenu("Other\u2026"); // TODO: what's the better way to do this?
-        sub.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
-
-
-        // Get list of image picker intents
-        Intent pickImageIntent = new Intent(Intent.ACTION_GET_CONTENT);
-        pickImageIntent.setType("image/*");
-        final List<ResolveInfo> imagePickerActivities =
-                pm.queryIntentActivities(pickImageIntent, 0);
-        final ComponentName[] imageActivities = new ComponentName[imagePickerActivities.size()];
-        for (int i = 0; i < imagePickerActivities.size(); i++) {
-            ActivityInfo activityInfo = imagePickerActivities.get(i).activityInfo;
-            imageActivities[i] = new ComponentName(activityInfo.packageName, activityInfo.name);
-        }
-
-        outerLoop:
-        for (ResolveInfo info : apps) {
-            final ComponentName itemComponentName =
-                    new ComponentName(info.activityInfo.packageName, info.activityInfo.name);
-            final String itemPackageName = itemComponentName.getPackageName();
-            // Exclude anything from our own package, and the old Launcher
-            if (itemPackageName.equals(getPackageName()) ||
-                    itemPackageName.equals("com.android.launcher")) {
-                continue;
-            }
-            // Exclude any package that already responds to the image picker intent
-            for (ResolveInfo imagePickerActivityInfo : imagePickerActivities) {
-                if (itemPackageName.equals(
-                        imagePickerActivityInfo.activityInfo.packageName)) {
-                    continue outerLoop;
-                }
-            }
-            MenuItem mi = sub.add(info.loadLabel(pm));
-            Intent launchIntent = new Intent(Intent.ACTION_SET_WALLPAPER);
-            launchIntent.setComponent(itemComponentName);
-            mi.setIntent(launchIntent);
-            Drawable icon = info.loadIcon(pm);
-            if (icon != null) {
-                mi.setIcon(icon);
-            }
-        }
-        return super.onCreateOptionsMenu(menu);
-    }
-
     private void findBundledWallpapers() {
         mBundledWallpaperThumbs = new ArrayList<Drawable>(24);
         mBundledWallpaperResIds = new ArrayList<Integer>(24);
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 2f58571..eb2b19d 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -479,7 +479,6 @@
     }
 
     public void removeAllWorkspaceScreens() {
-        Launcher.addDumpLog(TAG, "10249126 - removeAllWorkspaceScreens()", true);
         // Remove the pages and clear the screen models
         removeAllViews();
         mScreenOrder.clear();
@@ -490,7 +489,6 @@
         // Find the index to insert this view into.  If the empty screen exists, then
         // insert it before that.
         int insertIndex = mScreenOrder.indexOf(EXTRA_EMPTY_SCREEN_ID);
-        Launcher.addDumpLog(TAG, "10249126 - insertNewWorkspaceScreenBeforeEmptyScreen(" + insertIndex + ")", true);
         if (insertIndex < 0) {
             insertIndex = mScreenOrder.size();
         }
@@ -502,9 +500,6 @@
     }
 
     public long insertNewWorkspaceScreen(long screenId, int insertIndex) {
-        String log = "10249126 - insertNewWorkspaceScreen(" + screenId + ", " + insertIndex + ")";
-        Launcher.addDumpLog(TAG, log, true);
-
         if (mWorkspaceScreens.containsKey(screenId)) {
             throw new RuntimeException("Screen id " + screenId + " already exists!");
         }
@@ -522,7 +517,6 @@
     }
 
     public void createCustomContentPage() {
-        Launcher.addDumpLog(TAG, "10249126 - createCustomContentPage()", true);
         CellLayout customScreen = (CellLayout)
                 mLauncher.getLayoutInflater().inflate(R.layout.workspace_screen, null);
 
@@ -540,8 +534,6 @@
     }
 
     public void removeCustomContentPage() {
-        Launcher.addDumpLog(TAG, "10249126 - removeCustomContentPage()", true);
-
         CellLayout customScreen = getScreenWithId(CUSTOM_CONTENT_SCREEN_ID);
         if (customScreen == null) {
             throw new RuntimeException("Expected custom content screen to exist");
@@ -609,10 +601,7 @@
     }
 
     public void removeExtraEmptyScreen() {
-        int nScreens = getChildCount();
-        nScreens = hasCustomContent() ? nScreens - 1 : nScreens;
-
-        if (mWorkspaceScreens.containsKey(EXTRA_EMPTY_SCREEN_ID) && nScreens > 1) {
+        if (hasExtraEmptyScreen()) {
             CellLayout cl = mWorkspaceScreens.get(EXTRA_EMPTY_SCREEN_ID);
             mWorkspaceScreens.remove(EXTRA_EMPTY_SCREEN_ID);
             mScreenOrder.remove(EXTRA_EMPTY_SCREEN_ID);
@@ -620,13 +609,13 @@
         }
     }
 
+    public boolean hasExtraEmptyScreen() {
+        int nScreens = getChildCount();
+        nScreens = hasCustomContent() ? nScreens - 1 : nScreens;
+        return mWorkspaceScreens.containsKey(EXTRA_EMPTY_SCREEN_ID) && nScreens > 1;
+    }
+
     public long commitExtraEmptyScreen() {
-        Launcher.addDumpLog(TAG, "10249126 - commitExtraEmptyScreen()", true);
-
-        // Write all the logs to disk
-        Launcher.addDumpLog(TAG, "10249126 - commitExtraEmptyScreen() - dumping logs to disk", true);
-        mLauncher.dumpLogsToLocalData(false);
-
         CellLayout cl = mWorkspaceScreens.get(EXTRA_EMPTY_SCREEN_ID);
         mWorkspaceScreens.remove(EXTRA_EMPTY_SCREEN_ID);
         mScreenOrder.remove(EXTRA_EMPTY_SCREEN_ID);
@@ -643,13 +632,11 @@
 
 
     public CellLayout getScreenWithId(long screenId) {
-        Launcher.addDumpLog(TAG, "10249126 - getScreenWithId(" + screenId + ")", true);
         CellLayout layout = mWorkspaceScreens.get(screenId);
         return layout;
     }
 
     public long getIdForScreen(CellLayout layout) {
-        Launcher.addDumpLog(TAG, "10249126 - getIdForScreen()", true);
         Iterator<Long> iter = mWorkspaceScreens.keySet().iterator();
         while (iter.hasNext()) {
             long id = iter.next();
@@ -661,7 +648,6 @@
     }
 
     public int getPageIndexForScreenId(long screenId) {
-        Launcher.addDumpLog(TAG, "10249126 - getPageIndexForScreenId(" + screenId + ")", true);
         return indexOfChild(mWorkspaceScreens.get(screenId));
     }
 
@@ -682,8 +668,6 @@
             return;
         }
 
-        Launcher.addDumpLog(TAG, "10249126 - stripEmptyScreens()", true);
-
         int currentPage = getNextPage();
         ArrayList<Long> removeScreens = new ArrayList<Long>();
         for (Long id: mWorkspaceScreens.keySet()) {
@@ -699,7 +683,6 @@
 
         int pageShift = 0;
         for (Long id: removeScreens) {
-            Launcher.addDumpLog(TAG, "10249126 - \tremove(" + id + ")", true);
             CellLayout cl = mWorkspaceScreens.get(id);
             mWorkspaceScreens.remove(id);
             mScreenOrder.remove(id);
@@ -1058,9 +1041,6 @@
                 sp, mLauncher.getWindowManager(), mWallpaperManager);
     }
 
-
-
-
     protected void snapToPage(int whichPage, Runnable r) {
         if (mDelayedSnapToPageRunnable != null) {
             mDelayedSnapToPageRunnable.run();
@@ -1083,7 +1063,9 @@
         boolean mAnimating;
         long mAnimationStartTime;
         float mAnimationStartOffset;
-        final int ANIMATION_DURATION = 250;
+        private final int ANIMATION_DURATION = 250;
+        // Don't use all the wallpaper for parallax until you have at least this many pages
+        private final int MIN_PARALLAX_PAGE_SPAN = 4;
         int mNumScreens;
 
         public WallpaperOffsetInterpolator() {
@@ -1096,7 +1078,6 @@
             updateOffset(false);
         }
 
-
         private void updateOffset(boolean force) {
             if (mWaitingForUpdate || force) {
                 mWaitingForUpdate = false;
@@ -1138,19 +1119,43 @@
             if (getChildCount() <= 1) {
                 return 0;
             }
-            final int lastIndex = isLayoutRtl() ? 0 : getChildCount() - 1;
+
+            // Exclude the leftmost page
             final int firstIndex = isLayoutRtl() ? getChildCount() - 2 : 1;
+            // Exclude the last extra empty screen (if we have > MIN_PARALLAX_PAGE_SPAN pages)
+            int extra = numExtraScreensToIgnore();
+            final int lastIndex = isLayoutRtl() ? 0 + extra : getChildCount() - 1 - extra;
+
             int firstPageScrollX = getScrollForPage(firstIndex);
             int scrollRange = getScrollForPage(lastIndex) - firstPageScrollX;
             if (scrollRange == 0) {
                 return 0;
             } else {
-                // do different behavior if it's  a live wallpaper?
-                float offset = (getScrollX() - firstPageScrollX) / (float) scrollRange;
-                return offset;
+                // TODO: do different behavior if it's  a live wallpaper?
+                float offset = Math.min(1, (getScrollX() - firstPageScrollX) / (float) scrollRange);
+                offset = Math.max(0, offset);
+                // Don't use up all the wallpaper parallax until you have at least
+                // MIN_PARALLAX_PAGE_SPAN pages
+                int numScrollingPages = getNumScreensExcludingExtraEmptyScreenAndLeftmost();
+                int parallaxPageSpan = Math.max(MIN_PARALLAX_PAGE_SPAN, numScrollingPages) - 1;
+                return offset * (numScrollingPages - 1) / parallaxPageSpan;
             }
         }
 
+        private int numExtraScreensToIgnore() {
+            int numScrollingPages = getChildCount() - 1;
+            if (numScrollingPages > MIN_PARALLAX_PAGE_SPAN && hasExtraEmptyScreen()) {
+                return 1;
+            } else {
+                return 0;
+            }
+        }
+
+        private int getNumScreensExcludingExtraEmptyScreenAndLeftmost() {
+            int numScrollingPages = getChildCount() - 1 - numExtraScreensToIgnore();
+            return numScrollingPages;
+        }
+
         public void syncWithScroll() {
             float offset = wallpaperOffsetForCurrentScroll();
             mWallpaperOffset.setFinalX(offset);
@@ -1179,12 +1184,12 @@
         public void setFinalX(float x) {
             scheduleUpdate();
             mFinalOffset = Math.max(0f, Math.min(x, 1.0f));
-            if (getChildCount() != mNumScreens) {
+            if (getNumScreensExcludingExtraEmptyScreenAndLeftmost() != mNumScreens) {
                 if (mNumScreens > 0) {
                     // Don't animate if we're going from 0 screens
                     animateToFinal();
                 }
-                mNumScreens = getChildCount();
+                mNumScreens = getNumScreensExcludingExtraEmptyScreenAndLeftmost();
             }
         }
 
@@ -1746,7 +1751,6 @@
             mScreenOrder.add(getIdForScreen(cl));
         }
 
-        Launcher.addDumpLog(TAG, "10249126 - onEndReordering()", true);
         mLauncher.getModel().updateWorkspaceScreenOrder(mLauncher, mScreenOrder);
 
         // Re-enable auto layout transitions for page deletion.