Merge "Fix the build break in git_master-without-vendor"
diff --git a/api/11.xml b/api/11.xml
index b087c20..5087eca 100644
--- a/api/11.xml
+++ b/api/11.xml
@@ -43822,17 +43822,6 @@
 <parameter name="delayMS" type="long">
 </parameter>
 </method>
-<method name="waitForLoader"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
 </class>
 <class name="BroadcastReceiver"
  extends="java.lang.Object"
diff --git a/api/current.xml b/api/current.xml
index 9fd9ca8..46aa6f6 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -43874,17 +43874,6 @@
 <parameter name="delayMS" type="long">
 </parameter>
 </method>
-<method name="waitForLoader"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
 </class>
 <class name="BroadcastReceiver"
  extends="java.lang.Object"
@@ -237822,6 +237811,48 @@
 </parameter>
 </method>
 </class>
+<class name="WebStorage.Origin"
+ extends="java.lang.Object"
+ abstract="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="getOrigin"
+ return="java.lang.String"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getQuota"
+ return="long"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getUsage"
+ return="long"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+</class>
 <interface name="WebStorage.QuotaUpdater"
  abstract="true"
  static="true"
diff --git a/core/java/android/content/AsyncTaskLoader.java b/core/java/android/content/AsyncTaskLoader.java
index 4cf356f..3d6182b 100644
--- a/core/java/android/content/AsyncTaskLoader.java
+++ b/core/java/android/content/AsyncTaskLoader.java
@@ -175,7 +175,7 @@
     @Deprecated
     public void onCancelled(D data) {
     }
-    
+
     void executePendingTask() {
         if (mCancellingTask == null && mTask != null) {
             if (mTask.waiting) {
@@ -245,6 +245,8 @@
      * thread would cause a deadlock.
      * <p>
      * Use for testing only.  <b>Never</b> call this from a UI thread.
+     *
+     * @hide
      */
     public void waitForLoader() {
         LoadTask task = mTask;
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java
index 5fac525..99b686e 100644
--- a/core/java/android/view/GLES20Canvas.java
+++ b/core/java/android/view/GLES20Canvas.java
@@ -374,16 +374,18 @@
 
     @Override
     public void translate(float dx, float dy) {
-        nTranslate(mRenderer, dx, dy);
+        if (dx != 0.0f || dy != 0.0f) nTranslate(mRenderer, dx, dy);
     }
     
     private native void nTranslate(int renderer, float dx, float dy);
 
     @Override
     public void skew(float sx, float sy) {
-        throw new UnsupportedOperationException();
+        nSkew(mRenderer, sx, sy);
     }
 
+    private native void nSkew(int renderer, float sx, float sy);
+
     @Override
     public void rotate(float degrees) {
         nRotate(mRenderer, degrees);
diff --git a/core/java/android/webkit/WebStorage.java b/core/java/android/webkit/WebStorage.java
index 5345879..257ed2a 100644
--- a/core/java/android/webkit/WebStorage.java
+++ b/core/java/android/webkit/WebStorage.java
@@ -75,23 +75,23 @@
     private Handler mHandler = null;
     private Handler mUIHandler = null;
 
-    static class Origin {
-        String mOrigin = null;
-        long mQuota = 0;
-        long mUsage = 0;
+    public static class Origin {
+        private String mOrigin = null;
+        private long mQuota = 0;
+        private long mUsage = 0;
 
-        public Origin(String origin, long quota, long usage) {
+        private Origin(String origin, long quota, long usage) {
             mOrigin = origin;
             mQuota = quota;
             mUsage = usage;
         }
 
-        public Origin(String origin, long quota) {
+        private Origin(String origin, long quota) {
             mOrigin = origin;
             mQuota = quota;
         }
 
-        public Origin(String origin) {
+        private Origin(String origin) {
             mOrigin = origin;
         }
 
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 0a32c9e..78d4cd2 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -6724,50 +6724,59 @@
     }
 
     /**
-     * Returns true if x/y in content coordinates corresponds to a plugin.
+     * Returns plugin bounds if x/y in content coordinates corresponds to a
+     * plugin. Otherwise a NULL rectangle is returned.
      */
-    boolean isPluginAt(int x, int y) {
-        return nativePointInNavCache(x, y, mNavSlop) &&
-                nativeCacheHitIsPlugin();
+    Rect getPluginBounds(int x, int y) {
+        if (nativePointInNavCache(x, y, mNavSlop) && nativeCacheHitIsPlugin()) {
+            return nativeCacheHitNodeBounds();
+        } else {
+            return null;
+        }
     }
 
     /*
-     * Return true if the view (Plugin) is fully visible and maximized inside
-     * the WebView.
+     * Return true if the rect (e.g. plugin) is fully visible and maximized
+     * inside the WebView.
      */
-    boolean isPluginFitOnScreen(ViewManager.ChildView view) {
+    boolean isRectFitOnScreen(Rect rect) {
+        final int rectWidth = rect.width();
+        final int rectHeight = rect.height();
         final int viewWidth = getViewWidth();
         final int viewHeight = getViewHeightWithTitle();
-        float scale = Math.min((float) viewWidth / view.width, (float) viewHeight / view.height);
+        float scale = Math.min((float) viewWidth / rectWidth, (float) viewHeight / rectHeight);
         scale = mZoomManager.computeScaleWithLimits(scale);
         return !mZoomManager.willScaleTriggerZoom(scale)
-                && contentToViewX(view.x) >= mScrollX
-                && contentToViewX(view.x + view.width) <= mScrollX + viewWidth
-                && contentToViewY(view.y) >= mScrollY
-                && contentToViewY(view.y + view.height) <= mScrollY + viewHeight;
+                && contentToViewX(rect.left) >= mScrollX
+                && contentToViewX(rect.right) <= mScrollX + viewWidth
+                && contentToViewY(rect.top) >= mScrollY
+                && contentToViewY(rect.bottom) <= mScrollY + viewHeight;
     }
 
     /*
      * Maximize and center the rectangle, specified in the document coordinate
      * space, inside the WebView. If the zoom doesn't need to be changed, do an
      * animated scroll to center it. If the zoom needs to be changed, find the
-     * zoom center and do a smooth zoom transition.
+     * zoom center and do a smooth zoom transition. The rect is in document
+     * coordinates
      */
-    void centerFitRect(int docX, int docY, int docWidth, int docHeight) {
-        int viewWidth = getViewWidth();
-        int viewHeight = getViewHeightWithTitle();
-        float scale = Math.min((float) viewWidth / docWidth, (float) viewHeight
-                / docHeight);
+    void centerFitRect(Rect rect) {
+        final int rectWidth = rect.width();
+        final int rectHeight = rect.height();
+        final int viewWidth = getViewWidth();
+        final int viewHeight = getViewHeightWithTitle();
+        float scale = Math.min((float) viewWidth / rectWidth, (float) viewHeight
+                / rectHeight);
         scale = mZoomManager.computeScaleWithLimits(scale);
         if (!mZoomManager.willScaleTriggerZoom(scale)) {
-            pinScrollTo(contentToViewX(docX + docWidth / 2) - viewWidth / 2,
-                    contentToViewY(docY + docHeight / 2) - viewHeight / 2,
+            pinScrollTo(contentToViewX(rect.left + rectWidth / 2) - viewWidth / 2,
+                    contentToViewY(rect.top + rectHeight / 2) - viewHeight / 2,
                     true, 0);
         } else {
             float actualScale = mZoomManager.getScale();
-            float oldScreenX = docX * actualScale - mScrollX;
-            float rectViewX = docX * scale;
-            float rectViewWidth = docWidth * scale;
+            float oldScreenX = rect.left * actualScale - mScrollX;
+            float rectViewX = rect.left * scale;
+            float rectViewWidth = rectWidth * scale;
             float newMaxWidth = mContentWidth * scale;
             float newScreenX = (viewWidth - rectViewWidth) / 2;
             // pin the newX to the WebView
@@ -6778,10 +6787,10 @@
             }
             float zoomCenterX = (oldScreenX * scale - newScreenX * actualScale)
                     / (scale - actualScale);
-            float oldScreenY = docY * actualScale + getTitleHeight()
+            float oldScreenY = rect.top * actualScale + getTitleHeight()
                     - mScrollY;
-            float rectViewY = docY * scale + getTitleHeight();
-            float rectViewHeight = docHeight * scale;
+            float rectViewY = rect.top * scale + getTitleHeight();
+            float rectViewHeight = rectHeight * scale;
             float newMaxHeight = mContentHeight * scale + getTitleHeight();
             float newScreenY = (viewHeight - rectViewHeight) / 2;
             // pin the newY to the WebView
@@ -7514,8 +7523,7 @@
                     break;
 
                 case CENTER_FIT_RECT:
-                    Rect r = (Rect)msg.obj;
-                    centerFitRect(r.left, r.top, r.width(), r.height());
+                    centerFitRect((Rect)msg.obj);
                     break;
 
                 case SET_SCROLLBAR_MODES:
diff --git a/core/java/android/webkit/ZoomManager.java b/core/java/android/webkit/ZoomManager.java
index b4a33de..88a54ea 100644
--- a/core/java/android/webkit/ZoomManager.java
+++ b/core/java/android/webkit/ZoomManager.java
@@ -20,6 +20,7 @@
 import android.content.pm.PackageManager;
 import android.graphics.Canvas;
 import android.graphics.Point;
+import android.graphics.Rect;
 import android.os.Bundle;
 import android.os.SystemClock;
 import android.util.Log;
@@ -551,12 +552,12 @@
          * If the double tap was on a plugin then either zoom to maximize the
          * plugin on the screen or scale to overview mode.
          */
-        ViewManager.ChildView plugin = mWebView.mViewManager.hitTest(mAnchorX, mAnchorY);
-        if (plugin != null) {
-            if (mWebView.isPluginFitOnScreen(plugin)) {
+        Rect pluginBounds = mWebView.getPluginBounds(mAnchorX, mAnchorY);
+        if (pluginBounds != null) {
+            if (mWebView.isRectFitOnScreen(pluginBounds)) {
                 zoomToOverview();
             } else {
-                mWebView.centerFitRect(plugin.x, plugin.y, plugin.width, plugin.height);
+                mWebView.centerFitRect(pluginBounds);
             }
             return;
         }
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index 40cec3e..ac491ea 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -213,6 +213,11 @@
     renderer->scale(sx, sy);
 }
 
+static void android_view_GLES20Canvas_skew(JNIEnv* env, jobject canvas,
+        OpenGLRenderer* renderer, jfloat sx, jfloat sy) {
+    renderer->skew(sx, sy);
+}
+
 static void android_view_GLES20Canvas_setMatrix(JNIEnv* env, jobject canvas,
         OpenGLRenderer* renderer, SkMatrix* matrix) {
     renderer->setMatrix(matrix);
@@ -550,6 +555,7 @@
     { "nTranslate",         "(IFF)V",          (void*) android_view_GLES20Canvas_translate },
     { "nRotate",            "(IF)V",           (void*) android_view_GLES20Canvas_rotate },
     { "nScale",             "(IFF)V",          (void*) android_view_GLES20Canvas_scale },
+    { "nSkew",              "(IFF)V",          (void*) android_view_GLES20Canvas_skew },
 
     { "nSetMatrix",         "(II)V",           (void*) android_view_GLES20Canvas_setMatrix },
     { "nGetMatrix",         "(I)I",            (void*) android_view_GLES20Canvas_getNativeMatrix },
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index e3593da..ade85e5 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -268,6 +268,10 @@
                 renderer.scale(getFloat(), getFloat());
             }
             break;
+            case Skew: {
+                renderer.skew(getFloat(), getFloat());
+            }
+            break;
             case SetMatrix: {
                 renderer.setMatrix(getMatrix());
             }
@@ -508,6 +512,12 @@
     OpenGLRenderer::scale(sx, sy);
 }
 
+void DisplayListRenderer::skew(float sx, float sy) {
+    addOp(DisplayList::Skew);
+    addPoint(sx, sy);
+    OpenGLRenderer::skew(sx, sy);
+}
+
 void DisplayListRenderer::setMatrix(SkMatrix* matrix) {
     addOp(DisplayList::SetMatrix);
     addMatrix(matrix);
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index 7152334..05864ec 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -98,6 +98,7 @@
         Translate,
         Rotate,
         Scale,
+        Skew,
         SetMatrix,
         ConcatMatrix,
         ClipRect,
@@ -250,6 +251,7 @@
     void translate(float dx, float dy);
     void rotate(float degrees);
     void scale(float sx, float sy);
+    void skew(float sx, float sy);
 
     void setMatrix(SkMatrix* matrix);
     void concatMatrix(SkMatrix* matrix);
diff --git a/libs/hwui/Matrix.cpp b/libs/hwui/Matrix.cpp
index fe7f883..e7c0fe3 100644
--- a/libs/hwui/Matrix.cpp
+++ b/libs/hwui/Matrix.cpp
@@ -178,6 +178,24 @@
     data[kScaleZ] = sz;
 }
 
+void Matrix4::loadSkew(float sx, float sy) {
+    loadIdentity();
+
+    data[kScaleX]       = 1.0f;
+    data[kSkewX]        = sx;
+    data[kTranslateX]   = 0.0f;
+
+    data[kSkewY]        = sy;
+    data[kScaleY]       = 1.0f;
+    data[kTranslateY]   = 0.0f;
+
+    data[kPerspective0] = 0.0f;
+    data[kPerspective1] = 0.0f;
+    data[kPerspective2] = 1.0f;
+
+    mSimpleMatrix = false;
+}
+
 void Matrix4::loadRotate(float angle, float x, float y, float z) {
     data[kPerspective0]  = 0.0f;
     data[kPerspective1]  = 0.0f;
diff --git a/libs/hwui/Matrix.h b/libs/hwui/Matrix.h
index 23fc6c3..08f5d77 100644
--- a/libs/hwui/Matrix.h
+++ b/libs/hwui/Matrix.h
@@ -72,6 +72,7 @@
 
     void loadTranslate(float x, float y, float z);
     void loadScale(float sx, float sy, float sz);
+    void loadSkew(float sx, float sy);
     void loadRotate(float angle, float x, float y, float z);
     void loadMultiply(const Matrix4& u, const Matrix4& v);
 
@@ -97,6 +98,12 @@
         multiply(u);
     }
 
+    void skew(float sx, float sy) {
+        Matrix4 u;
+        u.loadSkew(sx, sy);
+        multiply(u);
+    }
+
     void rotate(float angle, float x, float y, float z) {
         Matrix4 u;
         u.loadRotate(angle, x, y, z);
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 16a1de7..2067acc1 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -766,6 +766,10 @@
     mSnapshot->transform->scale(sx, sy, 1.0f);
 }
 
+void OpenGLRenderer::skew(float sx, float sy) {
+    mSnapshot->transform->skew(sx, sy);
+}
+
 void OpenGLRenderer::setMatrix(SkMatrix* matrix) {
     mSnapshot->transform->load(*matrix);
 }
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index 7387b92..272c5c2 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -84,6 +84,7 @@
     virtual void translate(float dx, float dy);
     virtual void rotate(float degrees);
     virtual void scale(float sx, float sy);
+    virtual void skew(float sx, float sy);
 
     const float* getMatrix() const;
     void getMatrix(SkMatrix* matrix);
diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java
index 8929393..10c9a9a 100644
--- a/media/java/android/media/MediaScanner.java
+++ b/media/java/android/media/MediaScanner.java
@@ -1177,7 +1177,8 @@
             long lastModifiedSeconds = file.lastModified() / 1000;
 
             // always scan the file, so we can return the content://media Uri for existing files
-            return mClient.doScanFile(path, mimeType, lastModifiedSeconds, file.length(),false, true);
+            return mClient.doScanFile(path, mimeType, lastModifiedSeconds, file.length(),
+                    false, true);
         } catch (RemoteException e) {
             Log.e(TAG, "RemoteException in MediaScanner.scanFile()", e);
             return null;
@@ -1185,17 +1186,30 @@
     }
 
     public void scanMtpFile(String path, String volumeName, int objectHandle, int format) {
+        initialize(volumeName);
         MediaFile.MediaFileType mediaFileType = MediaFile.getFileType(path);
         int fileType = (mediaFileType == null ? 0 : mediaFileType.fileType);
+        File file = new File(path);
+        long lastModifiedSeconds = file.lastModified() / 1000;
 
         if (!MediaFile.isAudioFileType(fileType) && !MediaFile.isVideoFileType(fileType) &&
             !MediaFile.isImageFileType(fileType) && !MediaFile.isPlayListFileType(fileType)) {
-            // nothing to do
+
+            // no need to use the media scanner, but we need to update last modified and file size
+            ContentValues values = new ContentValues();
+            values.put(Files.FileColumns.SIZE, file.length());
+            values.put(Files.FileColumns.DATE_MODIFIED, lastModifiedSeconds);
+            try {
+                String[] whereArgs = new String[] {  Integer.toString(objectHandle) };
+                mMediaProvider.update(Files.getMtpObjectsUri(volumeName), values, "_id=?",
+                        whereArgs);
+            } catch (RemoteException e) {
+                Log.e(TAG, "RemoteException in scanMtpFile", e);
+            }
             return;
         }
 
         mMtpObjectHandle = objectHandle;
-        initialize(volumeName);
         try {
             if (MediaFile.isPlayListFileType(fileType)) {
                 // build file cache so we can look up tracks in the playlist
@@ -1213,11 +1227,6 @@
                 // MTP will create a file entry for us so we don't want to do it in prescan
                 prescan(path, false);
 
-                File file = new File(path);
-
-                // lastModified is in milliseconds on Files.
-                long lastModifiedSeconds = file.lastModified() / 1000;
-
                 // always scan the file, so we can return the content://media Uri for existing files
                 mClient.doScanFile(path, mediaFileType.mimeType, lastModifiedSeconds, file.length(),
                     (format == MtpConstants.FORMAT_ASSOCIATION), true);
diff --git a/media/java/android/mtp/MtpDatabase.java b/media/java/android/mtp/MtpDatabase.java
index ac476ff..d348e8b 100644
--- a/media/java/android/mtp/MtpDatabase.java
+++ b/media/java/android/mtp/MtpDatabase.java
@@ -185,7 +185,7 @@
         }
     }
 
-    private void endSendObject(String path, int handle, int format, long actualSize, boolean succeeded) {
+    private void endSendObject(String path, int handle, int format, boolean succeeded) {
         if (succeeded) {
             // handle abstract playlists separately
             // they do not exist in the file system so don't use the media scanner here
@@ -208,18 +208,6 @@
                     Log.e(TAG, "RemoteException in endSendObject", e);
                 }
             } else {
-                if (actualSize >= 0) {
-                    // update size if necessary
-                    ContentValues values = new ContentValues();
-                    values.put(Files.FileColumns.SIZE, actualSize);
-                    try {
-                        String[] whereArgs = new String[] {  Integer.toString(handle) };
-                        mMediaProvider.update(mObjectsUri, values, ID_WHERE, whereArgs);
-                    } catch (RemoteException e) {
-                        Log.e(TAG, "RemoteException in mMediaProvider.update", e);
-                    }
-                }
-
                 mMediaScanner.scanMtpFile(path, mVolumeName, handle, format);
             }
         } else {
diff --git a/media/jni/android_mtp_MtpDatabase.cpp b/media/jni/android_mtp_MtpDatabase.cpp
index 8f9b8a2..9abf6a2 100644
--- a/media/jni/android_mtp_MtpDatabase.cpp
+++ b/media/jni/android_mtp_MtpDatabase.cpp
@@ -99,7 +99,6 @@
     virtual void                    endSendObject(const char* path,
                                             MtpObjectHandle handle,
                                             MtpObjectFormat format,
-                                            int64_t actualSize,
                                             bool succeeded);
 
     virtual MtpObjectHandleList*    getObjectList(MtpStorageID storageID,
@@ -236,11 +235,11 @@
 }
 
 void MyMtpDatabase::endSendObject(const char* path, MtpObjectHandle handle,
-                                MtpObjectFormat format, int64_t actualSize, bool succeeded) {
+                                MtpObjectFormat format, bool succeeded) {
     JNIEnv* env = AndroidRuntime::getJNIEnv();
     jstring pathStr = env->NewStringUTF(path);
     env->CallVoidMethod(mDatabase, method_endSendObject, pathStr,
-                        (jint)handle, (jint)format, (jlong)actualSize, (jboolean)succeeded);
+                        (jint)handle, (jint)format, (jboolean)succeeded);
 
     if (pathStr)
         env->DeleteLocalRef(pathStr);
@@ -1094,7 +1093,7 @@
         LOGE("Can't find beginSendObject");
         return -1;
     }
-    method_endSendObject = env->GetMethodID(clazz, "endSendObject", "(Ljava/lang/String;IIJZ)V");
+    method_endSendObject = env->GetMethodID(clazz, "endSendObject", "(Ljava/lang/String;IIZ)V");
     if (method_endSendObject == NULL) {
         LOGE("Can't find endSendObject");
         return -1;
diff --git a/media/mtp/MtpDatabase.h b/media/mtp/MtpDatabase.h
index 6dcb931..4d9a1ae 100644
--- a/media/mtp/MtpDatabase.h
+++ b/media/mtp/MtpDatabase.h
@@ -42,7 +42,6 @@
     virtual void                    endSendObject(const char* path,
                                             MtpObjectHandle handle,
                                             MtpObjectFormat format,
-                                            int64_t size,
                                             bool succeeded) = 0;
 
     virtual MtpObjectHandleList*    getObjectList(MtpStorageID storageID,
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp
index 236cd0a..b1bd145 100644
--- a/media/mtp/MtpServer.cpp
+++ b/media/mtp/MtpServer.cpp
@@ -700,6 +700,9 @@
         if (ret && ret != -EEXIST)
             return MTP_RESPONSE_GENERAL_ERROR;
         chown((const char *)path, getuid(), mFileGroup);
+
+        // SendObject does not get sent for directories, so call endSendObject here instead
+        mDatabase->endSendObject(path, handle, MTP_FORMAT_ASSOCIATION, MTP_RESPONSE_OK);
     } else {
         mSendObjectFilePath = path;
         // save the handle for the SendObject call, which should follow
@@ -718,7 +721,6 @@
     MtpResponseCode result = MTP_RESPONSE_OK;
     mode_t mask;
     int ret;
-    uint64_t actualSize = -1;
 
     if (mSendObjectHandle == kInvalidObjectHandle) {
         LOGE("Expected SendObjectInfo before SendObject");
@@ -761,18 +763,11 @@
             result = MTP_RESPONSE_TRANSACTION_CANCELLED;
         else
             result = MTP_RESPONSE_GENERAL_ERROR;
-    } else if (mSendObjectFileSize == 0xFFFFFFFF) {
-        // actual size is likely > 4 gig so stat the file to compute actual length
-        struct stat s;
-        if (lstat(mSendObjectFilePath, &s) == 0) {
-            actualSize = s.st_size;
-            LOGD("actualSize: %lld\n", actualSize);
-        }
     }
 
 done:
     mDatabase->endSendObject(mSendObjectFilePath, mSendObjectHandle, mSendObjectFormat,
-            actualSize, result == MTP_RESPONSE_OK);
+            result == MTP_RESPONSE_OK);
     mSendObjectHandle = kInvalidObjectHandle;
     mSendObjectFormat = 0;
     return result;
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 6b559cf..747242f 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -1965,23 +1965,29 @@
             // behind it.
             return false;
         }
-        if (mStatusBar != null && mStatusBar.isVisibleLw()) {
-            Rect rect = new Rect(mStatusBar.getShownFrameLw());
-            for (int i=mStatusBarPanels.size()-1; i>=0; i--) {
-                WindowState w = mStatusBarPanels.get(i);
-                if (w.isVisibleLw()) {
-                    rect.union(w.getShownFrameLw());
+        if (false) {
+            // Don't do this on the tablet, since the system bar never completely
+            // covers the screen, and with all its transparency this will
+            // incorrectly think it does cover it when it doesn't.  We'll revisit
+            // this later when we re-do the phone status bar.
+            if (mStatusBar != null && mStatusBar.isVisibleLw()) {
+                Rect rect = new Rect(mStatusBar.getShownFrameLw());
+                for (int i=mStatusBarPanels.size()-1; i>=0; i--) {
+                    WindowState w = mStatusBarPanels.get(i);
+                    if (w.isVisibleLw()) {
+                        rect.union(w.getShownFrameLw());
+                    }
                 }
-            }
-            final int insetw = mRestrictedScreenWidth/10;
-            final int inseth = mRestrictedScreenHeight/10;
-            if (rect.contains(insetw, inseth, mRestrictedScreenWidth-insetw,
-                        mRestrictedScreenHeight-inseth)) {
-                // All of the status bar windows put together cover the
-                // screen, so the app can't be seen.  (Note this test doesn't
-                // work if the rects of these windows are at off offsets or
-                // sizes, causing gaps in the rect union we have computed.)
-                return false;
+                final int insetw = mRestrictedScreenWidth/10;
+                final int inseth = mRestrictedScreenHeight/10;
+                if (rect.contains(insetw, inseth, mRestrictedScreenWidth-insetw,
+                            mRestrictedScreenHeight-inseth)) {
+                    // All of the status bar windows put together cover the
+                    // screen, so the app can't be seen.  (Note this test doesn't
+                    // work if the rects of these windows are at off offsets or
+                    // sizes, causing gaps in the rect union we have computed.)
+                    return false;
+                }
             }
         }
         return true;
diff --git a/services/java/com/android/server/DropBoxManagerService.java b/services/java/com/android/server/DropBoxManagerService.java
index 4305c358..5c878c9 100644
--- a/services/java/com/android/server/DropBoxManagerService.java
+++ b/services/java/com/android/server/DropBoxManagerService.java
@@ -97,10 +97,18 @@
     // Ensure that all log entries have a unique timestamp
     private long mLastTimestamp = 0;
 
+    private volatile boolean mBooted = false;
+
     /** Receives events that might indicate a need to clean up files. */
     private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
+            if (intent != null && Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
+                mBooted = true;
+                return;
+            }
+
+            // Else, for ACTION_DEVICE_STORAGE_LOW:
             mCachedQuotaUptimeMillis = 0;  // Force a re-check of quota size
 
             // Run the initialization in the background (not this main thread).
@@ -132,7 +140,11 @@
         // Set up intent receivers
         mContext = context;
         mContentResolver = context.getContentResolver();
-        context.registerReceiver(mReceiver, new IntentFilter(Intent.ACTION_DEVICE_STORAGE_LOW));
+
+        IntentFilter filter = new IntentFilter();
+        filter.addAction(Intent.ACTION_DEVICE_STORAGE_LOW);
+        filter.addAction(Intent.ACTION_BOOT_COMPLETED);
+        context.registerReceiver(mReceiver, filter);
 
         mContentResolver.registerContentObserver(
             Settings.Secure.CONTENT_URI, true,
@@ -224,6 +236,9 @@
             Intent dropboxIntent = new Intent(DropBoxManager.ACTION_DROPBOX_ENTRY_ADDED);
             dropboxIntent.putExtra(DropBoxManager.EXTRA_TAG, tag);
             dropboxIntent.putExtra(DropBoxManager.EXTRA_TIME, time);
+            if (!mBooted) {
+                dropboxIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
+            }
             mContext.sendBroadcast(dropboxIntent, android.Manifest.permission.READ_LOGS);
 
         } catch (IOException e) {
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 1b3725c..3e930ae 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -3031,7 +3031,7 @@
     }
 
     private AttributeCache.Entry getCachedAnimations(WindowManager.LayoutParams lp) {
-        if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: params package="
+        if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: layout params pkg="
                 + (lp != null ? lp.packageName : null)
                 + " resId=0x" + (lp != null ? Integer.toHexString(lp.windowAnimations) : null));
         if (lp != null && lp.windowAnimations != 0) {
@@ -3052,7 +3052,7 @@
     }
 
     private AttributeCache.Entry getCachedAnimations(String packageName, int resId) {
-        if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: params package="
+        if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: package="
                 + packageName + " resId=0x" + Integer.toHexString(resId));
         if (packageName != null) {
             if ((resId&0xFF000000) == 0x01000000) {
@@ -9957,8 +9957,8 @@
                         // The top-most window will supply the layout params,
                         // and we will determine it below.
                         LayoutParams animLp = null;
-                        AppWindowToken animToken = null;
                         int bestAnimLayer = -1;
+                        boolean fullscreenAnim = false;
 
                         if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
                                 "New wallpaper target=" + mWallpaperTarget
@@ -10000,11 +10000,18 @@
                                     // window, we will always use its anim.
                                     if ((ws.mAttrs.flags&FLAG_COMPATIBLE_WINDOW) != 0) {
                                         animLp = ws.mAttrs;
-                                        animToken = ws.mAppToken;
                                         bestAnimLayer = Integer.MAX_VALUE;
-                                    } else if (ws.mLayer > bestAnimLayer) {
+                                    } else if (!fullscreenAnim || ws.mLayer > bestAnimLayer) {
                                         animLp = ws.mAttrs;
-                                        animToken = ws.mAppToken;
+                                        bestAnimLayer = ws.mLayer;
+                                    }
+                                    fullscreenAnim = true;
+                                }
+                            } else if (!fullscreenAnim) {
+                                WindowState ws = wtoken.findMainWindow();
+                                if (ws != null) {
+                                    if (ws.mLayer > bestAnimLayer) {
+                                        animLp = ws.mAttrs;
                                         bestAnimLayer = ws.mLayer;
                                     }
                                 }
diff --git a/tests/HwAccelerationTest/AndroidManifest.xml b/tests/HwAccelerationTest/AndroidManifest.xml
index 7099ab5..691aff28 100644
--- a/tests/HwAccelerationTest/AndroidManifest.xml
+++ b/tests/HwAccelerationTest/AndroidManifest.xml
@@ -166,6 +166,15 @@
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
+        
+        <activity
+                android:name="BitmapsSkewActivity"
+                android:label="_BitmapsSkew">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
 
         <activity
                 android:name="BitmapsAlphaActivity"
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsSkewActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsSkewActivity.java
new file mode 100644
index 0000000..099c0dd
--- /dev/null
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsSkewActivity.java
@@ -0,0 +1,56 @@
+/*
+ * 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.test.hwui;
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.os.Bundle;
+import android.view.View;
+
+@SuppressWarnings({"UnusedDeclaration"})
+public class BitmapsSkewActivity extends Activity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        final BitmapsView view = new BitmapsView(this);
+        setContentView(view);
+    }
+
+    static class BitmapsView extends View {
+        private Paint mBitmapPaint;
+        private final Bitmap mBitmap1;
+
+        BitmapsView(Context c) {
+            super(c);
+
+            mBitmap1 = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1);
+        }
+
+        @Override
+        protected void onDraw(Canvas canvas) {
+            super.onDraw(canvas);
+
+            canvas.translate(120.0f, 50.0f);
+            canvas.skew(0.2f, 0.3f);
+            canvas.drawBitmap(mBitmap1, 0.0f, 0.0f, mBitmapPaint);
+        }
+    }
+}