Fix NPE when requesting outsets for detached view.

Outsets are used during measure/layout pass, but this can be called on a
view that is not currently attached.

Bug: 21602590
Change-Id: I23e3acc45ca4bf7684d8913f839e29e8e9e94d78
(cherry picked from commit e660d4e96a2e5ac35f2dd6e2b43c588dd7e28358)
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index aeb4ac6..61db7bd 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -6672,7 +6672,11 @@
      * @hide
      */
     public void getOutsets(Rect outOutsetRect) {
-        outOutsetRect.set(mAttachInfo.mOutsets);
+        if (mAttachInfo != null) {
+            outOutsetRect.set(mAttachInfo.mOutsets);
+        } else {
+            outOutsetRect.setEmpty();
+        }
     }
 
     /**
@@ -13566,7 +13570,7 @@
             }
         }
 
-        onDetachedFromWindow();
+        onDetachedFromWindows();
         onDetachedFromWindowInternal();
 
         ListenerInfo li = mListenerInfo;