Merge "Populate the default workspace earlier" into jb-dev
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index 3b70d4f..fbd743b 100644
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -24,8 +24,9 @@
          that we put on each page for allowing folders to draw out of bounds -->
     <dimen name="qsb_bar_height_inset">34dp</dimen>
     <dimen name="qsb_bar_height">48dp</dimen>
-    <dimen name="qsb_padding_left">12dp</dimen>
-    <dimen name="qsb_padding_right">12dp</dimen>
+    <dimen name="qsb_padding_left">16dp</dimen>
+    <dimen name="qsb_padding_right">16dp</dimen>
+
     <dimen name="search_bar_height">48dp</dimen>
 
 <!-- Hotseat -->
@@ -36,8 +37,8 @@
     <dimen name="button_bar_height">94dip</dimen>
     <dimen name="button_bar_height_bottom_padding">14dp</dimen>
     <dimen name="button_bar_height_top_padding">20dp</dimen>
-    <dimen name="button_bar_width_left_padding">33dp</dimen>
-    <dimen name="button_bar_width_right_padding">33dp</dimen>
+    <dimen name="button_bar_width_left_padding">25dp</dimen>
+    <dimen name="button_bar_width_right_padding">25dp</dimen>
     <dimen name="button_bar_height_plus_padding">104dp</dimen>
 
 <!-- Folders -->
@@ -46,6 +47,11 @@
     <dimen name="folder_cell_width">86dp</dimen>
     <dimen name="folder_cell_height">90dp</dimen>
 
+    <dimen name="cell_layout_left_padding_port">12dp</dimen>
+    <dimen name="cell_layout_right_padding_port">12dp</dimen>
+    <dimen name="workspace_divider_padding_left">19dp</dimen>
+    <dimen name="workspace_divider_padding_right">19dp</dimen>
+
 <!-- AppsCustomize -->
     <dimen name="apps_customize_cell_width">96dp</dimen>
     <dimen name="apps_customize_cell_height">98dp</dimen>
@@ -58,11 +64,11 @@
 
 <!-- Workspace cell size -->
     <dimen name="workspace_cell_width_land">88dp</dimen>
-    <dimen name="workspace_cell_width_port">88dp</dimen>
+    <dimen name="workspace_cell_width_port">96dp</dimen>
     <dimen name="workspace_cell_height_land">88dp</dimen>
-    <dimen name="workspace_cell_height_port">88dp</dimen>
+    <dimen name="workspace_cell_height_port">96dp</dimen>
     <dimen name="workspace_width_gap_land">32dp</dimen>
-    <dimen name="workspace_width_gap_port">6dp</dimen>
+    <dimen name="workspace_width_gap_port">0dp</dimen>
     <dimen name="workspace_height_gap_land">0dp</dimen>
     <dimen name="workspace_height_gap_port">24dp</dimen>
 </resources>
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 5c91d35..3580545 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -279,6 +279,11 @@
         mWidgetPreviewIconPaddedDimension =
             (int) (mAppIconSize * (1 + (2 * sWidgetPreviewIconPaddingPercentage)));
         mFadeInAdjacentScreens = false;
+
+        // Unless otherwise specified this view is important for accessibility.
+        if (getImportantForAccessibility() == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
+            setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
+        }
     }
 
     @Override
diff --git a/src/com/android/launcher2/LauncherProvider.java b/src/com/android/launcher2/LauncherProvider.java
index 82aa07a..0720259 100644
--- a/src/com/android/launcher2/LauncherProvider.java
+++ b/src/com/android/launcher2/LauncherProvider.java
@@ -66,7 +66,7 @@
 
     private static final String DATABASE_NAME = "launcher.db";
 
-    private static final int DATABASE_VERSION = 11;
+    private static final int DATABASE_VERSION = 12;
 
     static final String AUTHORITY = "com.android.launcher2.settings";
 
@@ -477,14 +477,15 @@
                 version = 9;
             }
 
-            // We bumped the version twice during JB, once to update the launch flags, and once to
-            // update the override for the default launch animation.
-            if (version < 11) {
+            // We bumped the version three time during JB, once to update the launch flags, once to
+            // update the override for the default launch animation and once to set the mimetype
+            // to improve startup performance
+            if (version < 12) {
                 // Contact shortcuts need a different set of flags to be launched now
                 // The updateContactsShortcuts change is idempotent, so we can keep using it like
                 // back in the Donut days
                 updateContactsShortcuts(db);
-                version = 11;
+                version = 12;
             }
 
             if (version != DATABASE_VERSION) {
@@ -540,6 +541,9 @@
                                     newIntent.putExtra(
                                             Launcher.INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION, true);
                                     newIntent.setData(uri);
+                                    // Determine the type and also put that in the shortcut
+                                    // (that can speed up launch a bit)
+                                    newIntent.setDataAndType(uri, newIntent.resolveType(mContext));
 
                                     final ContentValues values = new ContentValues();
                                     values.put(LauncherSettings.Favorites.INTENT,
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 5d9cf81..02f1c22 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -24,6 +24,7 @@
 import android.content.res.TypedArray;
 import android.graphics.Canvas;
 import android.graphics.Rect;
+import android.os.Bundle;
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.util.AttributeSet;
@@ -1854,7 +1855,13 @@
     @Override
     public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
         super.onInitializeAccessibilityNodeInfo(info);
-        info.setScrollable(true);
+        info.setScrollable(getPageCount() > 1);
+        if (getCurrentPage() < getPageCount() - 1) {
+            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
+        }
+        if (getCurrentPage() > 0) {
+            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
+        }
     }
 
     @Override
@@ -1868,6 +1875,28 @@
         }
     }
 
+    @Override
+    public boolean performAccessibilityAction(int action, Bundle arguments) {
+        if (super.performAccessibilityAction(action, arguments)) {
+            return true;
+        }
+        switch (action) {
+            case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: {
+                if (getCurrentPage() < getPageCount() - 1) {
+                    scrollRight();
+                    return true;
+                }
+            } break;
+            case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: {
+                if (getCurrentPage() > 0) {
+                    scrollLeft();
+                    return true;
+                }
+            } break;
+        }
+        return false;
+    }
+
     protected String getCurrentPageDescription() {
         return String.format(getContext().getString(R.string.default_scroll_format),
                  getNextPage() + 1, getChildCount());
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index d15d318..00684bd 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -342,6 +342,11 @@
 
         // Disable multitouch across the workspace/all apps/customize tray
         setMotionEventSplittingEnabled(true);
+
+        // Unless otherwise specified this view is important for accessibility.
+        if (getImportantForAccessibility() == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
+            setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
+        }
     }
 
     // estimate the size of a widget with spans hSpan, vSpan. return MAX_VALUE for each