Merge "Updating backup restore logic" into ub-now-queens
diff --git a/res/layout-land/longpress_cling.xml b/res/layout-land/longpress_cling.xml
index 93bbc07..9672dd8 100644
--- a/res/layout-land/longpress_cling.xml
+++ b/res/layout-land/longpress_cling.xml
@@ -1,9 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
+    xmlns:launcher="http://schemas.android.com/apk/res-auto"
     android:id="@+id/longpress_cling"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    launcher:layout_ignoreInsets="true"
     android:background="@color/cling_scrim_background"
     android:orientation="vertical" >
 
diff --git a/res/layout-land/migration_cling.xml b/res/layout-land/migration_cling.xml
index 307cba8..db93da8 100644
--- a/res/layout-land/migration_cling.xml
+++ b/res/layout-land/migration_cling.xml
@@ -15,9 +15,11 @@
      limitations under the License.
 -->
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:launcher="http://schemas.android.com/apk/res-auto"
     android:id="@+id/migration_cling"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    launcher:layout_ignoreInsets="true"
     android:background="#FF009688"
     android:baselineAligned="false"
     android:gravity="center_vertical" >
diff --git a/res/layout-port/longpress_cling.xml b/res/layout-port/longpress_cling.xml
index 8e35f5c..c0b5267 100644
--- a/res/layout-port/longpress_cling.xml
+++ b/res/layout-port/longpress_cling.xml
@@ -1,9 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
+    xmlns:launcher="http://schemas.android.com/apk/res-auto"
     android:id="@+id/longpress_cling"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    launcher:layout_ignoreInsets="true"
     android:background="@color/cling_scrim_background" >
 
     <FrameLayout
diff --git a/res/layout-port/migration_cling.xml b/res/layout-port/migration_cling.xml
index dde8dbc..81689d3 100644
--- a/res/layout-port/migration_cling.xml
+++ b/res/layout-port/migration_cling.xml
@@ -15,9 +15,11 @@
      limitations under the License.
 -->
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:launcher="http://schemas.android.com/apk/res-auto"
     android:id="@+id/migration_cling"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    launcher:layout_ignoreInsets="true"
     android:background="#FF009688" >
 
     <RelativeLayout
diff --git a/res/layout-sw600dp-port/longpress_cling.xml b/res/layout-sw600dp-port/longpress_cling.xml
index b42d697..c4573d5 100644
--- a/res/layout-sw600dp-port/longpress_cling.xml
+++ b/res/layout-sw600dp-port/longpress_cling.xml
@@ -1,9 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
+    xmlns:launcher="http://schemas.android.com/apk/res-auto"
     android:id="@+id/longpress_cling"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    launcher:layout_ignoreInsets="true"
     android:background="@color/cling_scrim_background"
     android:orientation="vertical" >
 
diff --git a/src/com/android/launcher3/DragLayer.java b/src/com/android/launcher3/DragLayer.java
index 79d4278..a352b79 100644
--- a/src/com/android/launcher3/DragLayer.java
+++ b/src/com/android/launcher3/DragLayer.java
@@ -38,6 +38,8 @@
 import android.widget.FrameLayout;
 import android.widget.TextView;
 
+import com.android.launcher3.InsettableFrameLayout.LayoutParams;
+
 import java.util.ArrayList;
 
 /**
@@ -410,17 +412,43 @@
         return mDragController.dispatchUnhandledMove(focused, direction);
     }
 
-    public static class LayoutParams extends FrameLayout.LayoutParams {
+    @Override
+    public LayoutParams generateLayoutParams(AttributeSet attrs) {
+        return new LayoutParams(getContext(), attrs);
+    }
+
+    @Override
+    protected LayoutParams generateDefaultLayoutParams() {
+        return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
+    }
+
+    // Override to allow type-checking of LayoutParams.
+    @Override
+    protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
+        return p instanceof LayoutParams;
+    }
+
+    @Override
+    protected LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) {
+        return new LayoutParams(p);
+    }
+
+    public static class LayoutParams extends InsettableFrameLayout.LayoutParams {
         public int x, y;
         public boolean customPosition = false;
 
-        /**
-         * {@inheritDoc}
-         */
+        public LayoutParams(Context c, AttributeSet attrs) {
+            super(c, attrs);
+        }
+
         public LayoutParams(int width, int height) {
             super(width, height);
         }
 
+        public LayoutParams(ViewGroup.LayoutParams lp) {
+            super(lp);
+        }
+
         public void setWidth(int width) {
             this.width = width;
         }
diff --git a/src/com/android/launcher3/InsettableFrameLayout.java b/src/com/android/launcher3/InsettableFrameLayout.java
index 1c3d5a1..7343bf6 100644
--- a/src/com/android/launcher3/InsettableFrameLayout.java
+++ b/src/com/android/launcher3/InsettableFrameLayout.java
@@ -63,7 +63,7 @@
         return new LayoutParams(p);
     }
 
-    class LayoutParams extends FrameLayout.LayoutParams {
+    public static class LayoutParams extends FrameLayout.LayoutParams {
         boolean ignoreInsets = false;
 
         public LayoutParams(Context c, AttributeSet attrs) {